Dictionary Operations: What will the output of the following code be?

Code:

d = {1:2, 2:3, 3:4}
d.pop(2)
print(d)
  • {1:2, 3:4}
  • {2:3, 3:4} 
  • {1: , 2:3, 3:4}
  • {1:2, :3, 3:4}

The pop() operation in dictionary pops the key value pair for the key value provided in the pop argument, in this case, 2. 

Comments