Python Programming - Lambda Functions - Discussion
Discussion Forum : Lambda Functions - General Questions (Q.No. 55)
55.
What is the result of the following code?
numbers = [1, 2, 3, 4, 5]
squared = list(map(lambda x: x ** 2 if x % 2 == 0 else x, numbers))
print(squared)
Answer: Option
Explanation:
The lambda function squares even numbers and leaves odd numbers unchanged.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers