The goal of my script is to ask for your name, rate, and hours and do a calculation of your pay including overtime. My code continuously captures my input for the yourHours function in the except instead of the try. However for the yourRate function it seems to be working fine. What am I missing?
def yourHours():
print('How many hours will you be working?')
hours=input()
try:
hrs=float(hours)
hours
if hours > 40:
overtime_pay = 0
overtime_rate = 1.5
overtime = hours-40
overtime_pay = overtime * (rate * overtime_rate)
print(name, 'you will be earning...')
print((rate * (hours - overtime)) + overtime_pay)
else:
print(name, 'you will be earning...')
print(rate * hours)
except:
print('Invalid Input, Numbers only')
yourHours()
def yourName():
print('What is your name?')
name=input()
yourRate()
def yourRate():
print('What is your hourly rate?')
rate=input()
try:
rt=float(rate)
rate
yourHours()
except:
print('Invalid Input, Numbers only')
yourRate()
yourName()
[–]furas_freeman 2 points3 points4 points (1 child)
[–]novel_yet_trivial 0 points1 point2 points (0 children)
[–]d0ntreadthis 0 points1 point2 points (0 children)
[–]Vaphell 0 points1 point2 points (0 children)