help def even(x): if x%==0: print("yes") .... print("no") | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

help def even(x): if x%==0: print("yes") .... print("no")

20th Sep 2016, 11:00 AM
Артем Харичев
Артем Харичев - avatar
4 Answers
+ 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)
20th Sep 2016, 9:11 PM
vyavas
+ 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)
8th Sep 2019, 10:09 PM
OUSSAMA ROMDHANI
OUSSAMA ROMDHANI - avatar
0
def even(x) if x%2==0 print('Yes') else: print('No')
22nd Sep 2022, 9:33 AM
ABDUL WAHAB
- 1
x%==0 doesn't work. Try: x % 2 == 0 Demo: http://code.sololearn.com/cGdUyvz98n21/#py
20th Sep 2016, 11:10 AM
Filip Zirbo
Filip Zirbo - avatar