Nov-14-2019, 04:45 PM
I was just trying to show you how to do it without using try/except, in case you hadn't gotten that far in learning Python yet. I thought that might be the case because you said you got the original code from a tutorial. In general I tend to choose the simpler code. For checking if something is an integer, I tend to go with try/except. If I'm in a situation where the 'try' and 'if' solutions have similar complexity, or performance really matters, I'll go with 'if' if I expect there to be a lot of errors, and 'try' if I expect there to be few errors.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures