I'm working on a personal project that does the math to figure out what my paychecks should be given taxes, hours worked, etc. and so far it works. But I wanted to take it a step further to detect if the user has made a typo and entered letters, like "alkfdflkjad" instead of actual numbers when asked for the number of hours worked.
I've tried a couple different variations of if-else statements but they always give me an error instead of running the else prompt like "Please check your input!" My most recent code had this:
hours=float(input("Enter number of hours worked: "))
if hours.isdigit():
gross_pay=(hours*pay_rate)
else:
print(“Please enter a number.”)