def computepay(hours, rate) : if hours <= 40 : #Set hours per pay period before overtime pay = rate * hours else : pay = rate * 40 + ( rate * 1.5 * ( hours - 40) ) #Each instance of 40 must match the number set on line 2. This line sets overtime rate return pay try: inp = raw_input("Enter Hours: ") hours = float(inp) inp = raw_input("Enter Rate: ") rate = float(inp) except: print "Error, Please enter numeric input" quit() pay = computepay(hours, rate) print "Pay:", pay
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