Created
February 1, 2016 20:09
-
-
Save renauld94/f69e68fde9a3b8c88749 to your computer and use it in GitHub Desktop.
Pay program and overtime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Write a program to prompt the user for hours and rate per hour using raw_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 raw_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.# | |
hrs = float(raw_input("Enter Hours:")) | |
rate = float(raw_input("Enter rate:")) | |
if 0 < hrs <=40: | |
print hrs * rate | |
if hrs > 40: | |
print 40 * rate + (hrs-40)*rate*1.5 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment