I need this to rerun the initial inpput question if it gets a value that is unacceptable.
try:
hours = float(input("Please enter your hours worked: "))
if hours < 1 :
print("Please enter a value greater than 0 ")
#continue isn't working, figure out how to loop back to top instead
#temporary placeholder fix
hours= int(input("Please enter your hours worked: "))
#if a non-numerical value is entered
except:
print("Please enter a numerical value greater than 0")
#temporary placeholder fix
hours= int(input("Please enter your hours worked: "))
I tried usisng a continue statement, but it doesn't work with this code. How can I get the code to ask the user for input again if the input fails the if statement or triggers the except statement? I'm really new at this.