Jun-07-2017, 12:46 AM
Well, you didn't use any of the suggestions nilamo gave. You need to cast it as an int in order to add it to another int, you just need to handle cases where it isn't an int. Any easy way to do this is with isdigit:
>>> '32'.isdigit() True >>> 'Five'.isdigit() False >>> ''.isdigit() FalseYou can use this to detect a string containing an integer. Use an if statement to cast and add if it's an int, and to skip to the next line if it isn't. Or take either of nilamo's other two suggestions.
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