Python Forum
Problem writing code with my pseudocode
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem writing code with my pseudocode
#1
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"))
Reply
#2
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.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem with writing an objective oriented python assignment mikikiki 5 2,050 Feb-21-2023, 01:18 PM
Last Post: jefsummers
  I need help writing this code for string properties and methods hannah71605 4 3,120 Mar-22-2021, 12:36 PM
Last Post: menator01
  Need help in Code for Writing View Functions in Flask - Python Web Framework ashishsme14 2 3,037 May-22-2020, 03:43 AM
Last Post: snippsat
  HELP - Writing code returning True or False Kokuzuma 2 2,791 Nov-01-2018, 03:37 AM
Last Post: Kokuzuma
  Can't figure out how to write the correct functions for my pseudocode mkrodick 2 2,720 Jul-30-2018, 12:30 PM
Last Post: ichabod801
  Speed of progress of writing code Johno 2 2,887 Jan-19-2018, 01:56 AM
Last Post: dwiga
  Converting pseudocode to Python qwertyK 3 23,687 Oct-24-2017, 01:41 PM
Last Post: qwertyK
  Need Help with writing this code!? r6lay 7 5,892 Feb-13-2017, 10:03 AM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020