hoursWorked=float(input("Please enter the number of hours worked")) print if hoursWorked<0 or hoursWorked>40: hoursTrue=0 print "You entered {} hours, that is not a valid entry".format(hoursWorked) print "Please enter a number between 0 and 40" else: hoursTrue=1 print "You entered {} hours".format(hoursWorked) payRate=float(input("Please enter the employee's hourly pay rate")) print if payRate<7.5 or payRate>18.25: payTrue=0 print "You entered {} as the employee's pay rate, this is incorrect.".format(payRate) print "The employee's pay rate should be in the range of $7.50 and $18.25" else: print "you entered {} as the employee's pay rate".format(payRate) payTrue=1 grossPay=hoursWorked*payRate if payTrue==1 and hoursTrue==1: print "The employee's gross pay is ${:,.2f} ".format(grossPay) else: print"I'm sorry but the info you have entered is invalid." print "Please try entering valid info."
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