educative.io

Error not being thrown for lambda

my_func = lambda num: “High” if num > 50

print(my_func(60))

Hi Harsha!
The compiler is throwing error because you haven’t added the check for else statement.
The correct code is given below:

my_func = lambda num: "high" if num > 50 else num

Hope it helps. If you still have any queries, please let us know.
Thank you!