Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 New to python via Prof Chuck Severance
Hello everyone,

I am Paul and began taking python online thru Prof Chuck Severance

Just wanted to ask if anyone can help in correcting assignments.

According to the code checker, there's a mismatch on the results, and my code needs correction.

The output of this message does not indent my code. The lines after each "if" statement have been indented.

Thanks in advance for any feedback!

Assignment 3.1 py4e
3.1 Write a program to prompt the user for hours and rate per hour using input to compute gross pay. Pay the hourly rate for the hours up to 40 and 1.5 times the hourly rate for all hours worked above 40 hours. Use 45 hours and a rate of 10.50 per hour to test the program (the pay should be 498.75). You should use input to read a string and float() to convert the string to a number. Do not worry about error checking the user input - assume the user types numbers properly.

The output is 498.75

Here's my code:

hrs=float(input("Enter Hours: "))
if hrs <= 40 :
    rate=float(input("Enter Rate: "))
    print("Gross pay is ",pay)
if hrs > 40 :
    rate=float(input("Enter Rate: "))
    grossotpay=pay + overtimepay
    print("Gross pay is ",grossotpay)
buran wrote May-23-2020, 04:42 AM:
Please, use proper tags when post code, traceback, output, etc.
See BBcode help for more info.
Place your code within tags when posting so that its readable. You can refer to the instructions in the below link.

You could have made some mistake while indenting, otherwise your code is fine.
It looks like the website is looking for:
Your code is outputting this instead:
Gross pay is 498.75
What is the error that you are getting?
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs

Top Page

Forum Jump:

Users browsing this thread: 1 Guest(s)