

InterviewSolution
Saved Bookmarks
1. |
What is the list comprehension equivalent for: list(map(lambda x:x**-1, [1, 2, 3]))?(a) [1|x for x in [1, 2, 3]](b) [-1**x for x in [1, 2, 3]](c) [x**-1 for x in [1, 2, 3]](d) [x^-1 for x in range(4)]This question was posed to me during a job interview.I'd like to ask this question from List Comprehension topic in chapter Lists & List Comprehension of Python |
Answer» Right answer is (c) [x**-1 for x in [1, 2, 3]] |
|