निम्नलिखित कोड का आउटपुट क्या है?
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
{4: 'D', 5: 'E', 1: 'A', 2: 'B', 3: 'C'}
B
{1: 'A', 2: 'B', 3: 'C', 4: 'D', 5: 'E'}
C
{4: 'D', 5: 'E'}
D
None of these
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 froma1tob1. -
After
b1.update(a1),b1will 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'}
Output: (A)
Correct Answer: A) {4: 'D', 5: 'E', 1: 'A', 2: 'B', 3: 'C'}