Skip to content

Instantly share code, notes, and snippets.

@pbhj
Created October 24, 2014 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pbhj/426b66119595e1ea3883 to your computer and use it in GitHub Desktop.
Save pbhj/426b66119595e1ea3883 to your computer and use it in GitHub Desktop.
# python program to calculate pay
# pr4e exercise 3.1; pbhj
# assign variables to user values entered
# no checking yet
hrs = raw_input("Enter Hours: ")
h = float(hrs)
rate = raw_input("Enter Rate: ")
r = float(rate)
if h >= 40:
# pay is normal rate to 40 hours +
# 1.5 times rate for additional hours
pay = (40 * r) + ((h - 40) * (1.5 * r))
print pay
if h < 40:
pay = h * r
print pay
#end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment