Python Forum

Full Version: Problem writing code with my pseudocode
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone, first time posting here. I was assigned the task of preparing a flowchart and pseudocode for a program that, when given a numerical input from the end user, calculates the hours worked in a 5 day week and in a 252 day year. We are not required to complete the code, but I really wanted to see where I could get with my pseudocode. I am lose from here though. I'm sure I am making silly mistakes, but it's my first real programming course, so please forgive me!

start
input myNumber
set myWeek = myNumber * 5
set myYear = myNumber * 252
print ("Please enter your hours: myNumber"), (("myWeek", "myYear"))
You send the question to input as a parameter, and get the response back:

myNumber = input('Please enter your hours: ')
However, you won't get a number back (Unless you are using Python 2.7, which you shouldn't be. Use Python 3.6), you will get a string back. You will need to convert that string to a number with int().

You don't need set. There is no start statement in Python.

You might want to check out a tutorial on writing Python code before writing Python code.