🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

निम्नलिखित कोड का परिणाम क्या है ?

What is the output of the following code ?

a = {1: "A", 2: "B", 3: "C"}
b = {4: "D", 5: "E"}
a.update(b)
print(a)
A
{1: 'A', 2: 'B', 3: 'C'}
B
{1: 'A', 2: 'B', 3: 'C', 4: 'D', 5: 'E'}
C
Error
D
{4: 'D', 5: 'E'}
Explanation

Sure!

The update() method adds all key-value pairs from dictionary b to dictionary a.

So, a becomes {1: 'A', 2: 'B', 3: 'C', 4: 'D', 5: 'E'}.

Answer: (B) {1: 'A', 2: 'B', 3: 'C', 4: 'D', 5: 'E'}.

Correct Answer: B) {1: 'A', 2: 'B', 3: 'C', 4: 'D', 5: 'E'}

Latest Updates