22
Question Question 22
Which of the following Python codes will give the same output if
dict = {"diary":1, "book":3, "novel":5}(i) dict.pop("book")
(ii) del dict["book"]
(iii) dict.update({"diary":1,"novel":5})
- (i), (ii), (iii)
- (1), (ii)
- (i), (iii)
- (ii), (iii)
(i), (ii)
Reason — Expression dict.pop("book") and del dict["book"] will give same output as both of them are removing the key "book" from dict i.e., {'diary': 1, 'novel': 5}