is_even one question


#1

my code:

def is_even(x):
x = int(raw_input("Please enter a number:"))
if x%2 == 0:
return True
else:
return False

However it return
Oops, try again. is_even(16) raised the following error: invalid literal for int() with base 10: ''

I don't know where the problem is, anyone could figure it out? Thanks!


#2

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

number = int(raw_input("Enter a number: "))
print is_even(number)`

Enter the value and than call the value in that function , dont change it while calling it


#3

Thanks to diwakar_sharm
I understand what's wrong with my logic
:grinning: