Nov-01-2018, 06:04 AM
I am supposed to make a code that using the function computepay() in order to calculate gross pay including time-and-a-half. In my online homework checker, it says it works fine, but whenever I try to open this .py file, it immediately terminates/closes itself. Something must be wrong, but I have no idea what. Help would be sooo appreciated!
prompt = input('Enter number of hours:\n')
hours = float(prompt)
prompt = input('Enter hourly rate:\n')
rate = float(prompt)
def computepay(hours,rate):
if 0 <= hours <= 40:
pay = hours * rate
elif 40 < hours:
pay = ((hours - 40) * rate * 1.5) + (40 * rate)
return pay
pay = computepay(hours,rate)
print(pay)
pay = input('Press enter to exit')
