I have this function where the user is supposed to give a number. I am having a little issue with my try function. If I enter a string like "abc", it will first tell me to give an integer. So when I write "123" next time, it won't work. This is what I receive then:
UnboundLocalError: local variable 'limit' referenced before assignment
My code:
def limitchooser()
try:
limit = int(input("Enter your limit: "))
except ValueError:
print("Please enter an integer!")
limitchooser()
return limit