I'm trying to code in a condition where if a user doesn't input an integer, it comes up with an error message. I'm using if statements to generate this. How would I do this??
Age=int(input("What is your age in years?")) if Age>20 and Age<150: print("You are an adult") elif Age>20 and Age>=150: print("Not a valid age") elif Age<20: print("still a teenager") If someone inputted £ as their age, is it possible for the message to print as "Invalid number. Please try again." ?
I've tried to recode it and it didn't work.