Why am I getting the error **not all arguments converted during string formatting** in my python code?
Question:
I searched about it and the other person who posted a similar issue had a typo error but I can’t find that in mine.strong text
here’s the code –
num = raw_input("Enter any number: ")
def is_even(x):
if x % 2 == 0:
return True
else:
return False
print is_even(num)
Answers:
Convert your raw_input
to int
Ex:
num = int(raw_input("Enter any number: "))
def is_even(x):
if x % 2 == 0:
return True
else:
return False
print is_even(num)
I searched about it and the other person who posted a similar issue had a typo error but I can’t find that in mine.strong text
here’s the code –
num = raw_input("Enter any number: ")
def is_even(x):
if x % 2 == 0:
return True
else:
return False
print is_even(num)
Convert your raw_input
to int
Ex:
num = int(raw_input("Enter any number: "))
def is_even(x):
if x % 2 == 0:
return True
else:
return False
print is_even(num)