Issue
I've been stuck at the assignment 2.3 of Python for Everybody.
The output is correct, but it keeps saying it is "Mismatch".
2.3
Write a program to prompt the user for hours and rate per hour using input to compute gross pay. Use 35 hours and a rate of 2.75 per hour to test the program (the pay should be 96.25). You should use input to read a string and float() to convert the string to a number. Do not worry about error checking or bad user data.
hrs = float(input("Enter Hours:"))
rate = float(input("Enter Rate:"))
pay = (hrs*rate)
print(pay)
Solution
This questions is missing some data, but I went to that exercise and checked it out. You had a very small error, and if you checked the right side properly, you would see that you were just missing a prefix in the output ("Pay: 96.25").
The following code should pass the exercise:
hrs = float(input("Enter Hours:"))
rate = float(input("Enter Rate:"))
pay = (hrs*rate)
print("Pay:", pay)
Answered By - Ensar Sarajcic
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.