I am trying to translate the below statement into Python but struggle with a reoccuring error.
hours = input (prompt1) ^ IndentationError: expected an indented block
A worker gets paid an hourly wage, when working up to 40 hours per week. When the time at work goes above 40 hours in a week, the worker is being paid overtime rate, which is 1.5 times the hourly wage. Given the hours worked per week, and the hourly wage, compute the weekly salary of the worker.
prompt1 = 'How many hours did you work?\n'
try: hours = input (prompt1)
prompt2 = 'What is your hourly rate?\n'
rate = input (prompt2)
hours = float(hours)
rate = float(rate)
print float(hours) * float(rate*1.5)
except: print('Error, Please enter a number')
I really appreciate your help.
Aucun commentaire:
Enregistrer un commentaire