So basically I'm pretty much new to python. The last time I tried learning python was version 5 or 6 (I kinda forgot) and unfortunately stopped learning it because of other irl things to focus on. Now I'm back but things seemed to have changed a bit on Python 3.8, And I need help!
Currently I'm trying to play around with user input where user inputs name and age. The problem I'm facing right now is with the age code lines, Im trying to make user put only intergers and when they put anything other than integer than it should loop back to original line. Currently, Im trying to use this:
def inputnumber(message):
while true:
try:
userinput = int(input(message))
except ValueError:
print("Please input integers")
continue
else:
return userinput
break
The problem is basically python is bypassing all those codes and not outputting the message. I suspect it's my outdated use of codes from back at version 5 or 6.
Any of you got any ideas? Thank you in advance!