निम्नलिखित कोड का आउटपुट क्या है?
What is the output of following code ?
a1={1:"A",2:"B",3:"C"}
b1={4:"D",5:"E"}
b1.update(a1)
print(b1)
A)
B)
C)
D)
Explanation:
Sure! Here's a concise explanation:
-
We have two dictionaries:
a1 = {1: "A", 2: "B", 3: "C"}
b1 = {4: "D", 5: "E"}
-
The
update()
method adds the items froma1
tob1
. -
After
b1.update(a1)
,b1
will include all key-value pairs from both dictionaries.
So, the final result of b1
will be:
{4: 'D', 5: 'E', 1: 'A', 2: 'B', 3: 'C'}