निम्नलिखित कोड का परिणाम क्या है ?
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 dictionaryb
into dictionarya
. - After calling
a.update(b)
, the dictionarya
will now include the key-value pairs fromb
. So, the updated dictionarya
will be{1: 'A', 2: 'B', 3: 'C', 4: 'D', 5: 'E'}
.