It looks here like you're checking that the input is of type int, but you're doing this after you've already tried to cast it to a int in line 16. This means you're not going to avoid an exception if something weird is inputted. A better way to do this is to use a try/except block for catching a ValueError as you try int(number). This is technically a bug so it's something you'll need to fix up.