Question

1.
2.
3.
4.
Answer (Detailed Solution Below)

Option 4 : [6, 12]

Advertisement

Detailed Solution

सही उत्तर [6, 12] है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

What does the following Python map-filter-lambda code output? / map-filter-lambda वाले निम्नलिखित Python कोड का आउटपुट क्या है? print(list(map(lambda x: x * 3, filter(lambda x: x % 2 == 0, [1, 2, 3, 4, 5]))))

1.
[3, 6, 9, 12, 15]
2.
[6, 12, 18]
3.
[2, 4]
4.
[6, 12]

Correct Answer: [6, 12]

filter keeps the even numbers [2, 4] and map triples each of them: [6, 12]. / filter सम संख्याएँ [2, 4] रखता है और map प्रत्येक को तिगुना करता है: [6, 12]।

Downloaded from PrepSnap (prepsnap.in)