I've done this before but i think this error is showing up because I'm not looping the code, the code works only once then on the second attempt is shows an error.
My Code:
import string
import time
def timer(x):
for n in range(x,0,-1):
time.sleep(1)
print(n)
print("Times Up"+"\n")
ask("Time for: ")
def ask(a):
x=int(input(str(a)))
print("\n"+"Clock's Ticking")
timer(x)
try:
ask("Time for: ")
except ValueError:
ask("Enter a number to time: ")
I want my code to not error when i put in something that isnt a integer for the time but dont know how to loop the exception code until the user enters a integer.