""" Many companies pay time-and-a-half for any hours worked above 40 hours in a given week. Write a program to input the number of hours worked and the hourly rate and display the the total wages and the amount of ovetime pay for the week. Test all the appropriate conditions. """ rate = 12 hours = int(input("How many hours did you work this week?")) if hours > 40: overtime = hours - 40 else: overtime = 0 overtime_pay = overtime * rate * 1.5 total_pay = hours * float(rate) + overtime_pay result = " Total wages for the week are ${0:.2f} with ${1:.2f} " \ "of overtime".format(float(total_pay), float(overtime_pay)) print result
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question