🚀 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)
B)
C)
D)

Explanation:

The output will be:

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

Explanation:

  • The update() method adds key-value pairs from dictionary b into dictionary a.
  • After calling a.update(b), the dictionary a will now include the key-value pairs from b. So, the updated dictionary a will be {1: 'A', 2: 'B', 3: 'C', 4: 'D', 5: 'E'}.
Latest Updates