+ 1
help def even(x): if x%==0: print("yes") .... print("no")
4 Respostas
+ 3
x = 547432145678 # The number to test
even = lambda x: "Yes" if x%2==0 else "No"
# this is the same as saying
#def even(x)
# if x%2==0
# print('Yes')
# else:
# print('No')
print(even(x)) # Prints our result (yes or no)
+ 2
x = 9865412785 # The number to test
even = lambda x: "Yes" if x%2==0 else "No"
this is the same as saying
def even(x)
if x%2==0
print('Yes')
else:
print('No')
print(even(x)) # Prints our result (yes or no)
0
def even(x)
if x%2==0
print('Yes')
else:
print('No')
- 1
x%==0 doesn't work.
Try: x % 2 == 0
Demo: http://code.sololearn.com/cGdUyvz98n21/#py