Jan-11-2018, 10:30 AM
(This post was last modified: Jan-11-2018, 10:38 AM by StoopidChicken.)
Thank you, completely forgot about that.
That works just as well, I've gotten into the habit of making a function in case I want to check multiple times. I just find it easier.
(Jan-11-2018, 10:28 AM)Gribouillis Wrote: However, why not simply write
try: ans = int(ans) except TypeError: print("You didn't enter an integer.") else: print("You entered an integer.")? This avoid a type-checking function.
That works just as well, I've gotten into the habit of making a function in case I want to check multiple times. I just find it easier.