21
Question Question 21
Which of the following will give error if d1 is as shown below?
d1 = {"a":1, "b":2, "c":3}- print(len(d1))
- print(d1.get("b"))
- d1["a"] = 5
- None of these
None of these
Reason — print(len(d1)) will print the length of d1 i.e. 3print(d1.get("b")) will return the value of key "b" i.e. 2d1["a"] = 5 will update the value of key "a" to 5.
Hence, all the expressions above will execute with no error.