Skip to content

Instantly share code, notes, and snippets.

@renauld94
Created February 1, 2016 20:09
Show Gist options
  • Save renauld94/f69e68fde9a3b8c88749 to your computer and use it in GitHub Desktop.
Save renauld94/f69e68fde9a3b8c88749 to your computer and use it in GitHub Desktop.
Pay program and overtime
# 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