python
Dashboard
My Repos
Compilers
Python Online
Node JS Online
Golang Online
codepy
Login
My Repos
Sign Out
Online Python Interpreter
Stop
Run
print("Welcome to PayCalc!\n") wage = float(input("How much do you make per hour?\n")) hours = float(input("How many hours for the week?\n")) def as_currency(amount): if amount >= 0: return '${:,.2f}'.format(amount) else: return '-${:,.2f}'.format(-amount) if hours <= 40: weekincome = wage*hours monthincome = weekincome*4 print("It has been calculated that if you work {} hours at a rate of {}, you should make a total of {}/week ({}/month)".format(int(round(hours)),as_currency(wage),as_currency(weekincome),as_currency(monthincome))) else: regularpay = wage*40 overtimehours = hours - 40 overtimerate = wage*1.5 overtimeincome = (overtimehours * overtimerate) print("Regular pay: {}/wk + your overtime rate of {}/hr".format(as_currency(regularpay),as_currency(overtimerate))) print("Hours of overtime: {}".format(int(round(overtimehours)))) print("Total overtime income: {}".format(as_currency(overtimeincome))) weekincome = (40*wage) + overtimeincome #if worked overtime every week monthincome = weekincome*4 overtimeonce = weekincome + (regularpay*3) print("It has been calculated that you should make a total of {}/week with overtime ({}/month) if worked {} hours every week.\nIf worked {} hours during one week and 40 hours/wk every other week, you'd make {} for the month".format(as_currency(weekincome),as_currency(monthincome),int(round(hours)),int(round(hours)),as_currency(overtimeonce)))
Share this code with others
Public
Clear
My Repos
Repo
Lang
Login
Register
Login
Create a free account. No Credit card info required.
I agree with the Codepy
Term of Service
Sign Up