Why do I get “TypeError: not all arguments converted during string formatting” trying to check for an even/odd number?

Here is how to fix it:

n = int(input("type a whole number:"))

Since input() returns a string, you need to convert it to an int first, using int().

Leave a Comment