Skip to content

Instantly share code, notes, and snippets.

@jmangrad
Last active May 30, 2020 23:48
Show Gist options
  • Save jmangrad/2b5e8760fd0c034e9dc175ca15b46869 to your computer and use it in GitHub Desktop.
Save jmangrad/2b5e8760fd0c034e9dc175ca15b46869 to your computer and use it in GitHub Desktop.
Write a program to prompt the user for hours and rate per
hour to compute gross pay. give the employee 1.5
times the hourly rate for hours worked above 40 hours.
Enter Hours: 45
Enter Rate: 10
Pay: 475.0
hours = int(input("Enter hours worked: ")) # asks user for hours worked for the week
rate = float(input("Enter how much you earn per hour: ")) # asks user how much per hour they get paid
if hours > 40:
pay = (1.5 * rate * (hours -40) + (40 * rate))
print(pay)
else:
pay = rate * hours
print(pay)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment