Question

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

Option 3 : 25

Advertisement

Detailed Solution

सही उत्तर 25 है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

What does the following Python dictionary-comprehension code output? / शब्दकोश बोध वाले निम्नलिखित Python कोड का आउटपुट क्या है? d = {x: x ** 2 for x in range(5)} print(d[3] + d[4])

1.
13
2.
20
3.
25
4.
49

Correct Answer: 25

The dict maps 3 to 9 and 4 to 16; 9 + 16 = 25. Option (a) adds the keys instead of the values. / शब्दकोश 3 को 9 और 4 को 16 से मानचित्रित करता है; 9 + 16 = 25। विकल्प (a) मानों के बजाय कुंजियाँ जोड़ देता है।

Downloaded from PrepSnap (prepsnap.in)