Is_even


#1

def is_even(x):
if x%2==0:
return "True"
else:
return "False"

can someone please tell me what is wrong with this code. it keeps saying that 32 returned True instead of the expected 'True'. I know the answer is probably screaming at me. But please im not the greatest at coding and need help.


#2

Your function had to return Boolean data type(True/False) but as you surround True/False with quotes ,Its no longer a boolean value.


#3

Thank you. That makes complete sense


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.