Ask coding questions

← Back to all posts
How do I make else not ONLY except integers
Maxb0tbeep

I know this is a bit simple but in my code how can I make an if statement not crash the whole program if you type in anything other than an int? I want the else part to activate instead but it crashes

code:
numberToCount = 0

Voters
Maxb0tbeep
Comments
hotnewtop
CodingElf66

You can use the isinstance function in Python to do it.

Now you can mark this as answered!

MrVoo

Try this:

MrVoo

Did it work?