Ultimate access to all questions.
Upgrade Now 🚀
Sign in to unlock AI tutor
Which of the following code blocks correctly demonstrates how to create a lambda function in Python to determine if a number is even or odd?
A
my_func = lambda x: if x % 2 == 0 ‘Even‘ else ‘Odd‘
B
my_func = lambda x: ‘Even‘ if x % 2 == 0 else ‘Odd‘
C
my_func = lambda x: if x / 2 == 0 ‘Even‘ else ‘Odd‘
D
my_func = lambda x: ‘Even‘ if x % 2 = 0 else ‘Odd‘
E
my_func = lambda x: if x % 2 == 0 ‘Even‘ elif x % 2 != 0 ‘Odd‘