I'm trying to create a function that validates user input using exceptions.
def int_input(message):
while True:
try:
x=int(input(f'{message}: '))
return x
break
except:
print("Enter a valid integer!")
print()
continue
a=int_input("Enter num: ") print(a)
The code looks messed up, is there a better way to write this?