20
Question Question 20
Which of the following will delete key_value pair for key="tiger" in dictionary?
di = {"lion":"wild","tiger":"wild","cat": "domestic", "dog":"domestic"}- del di["tiger"]
- di["tiger"].delete( )
- delete(di["tiger"])
- del(di.["tiger"])
del di["tiger"]
Reason — del keyword is used to delete an item with the specified key name. Here, tiger is the key name which is specified with del statement in expression: del di["tiger"]. Hence, it will delete tiger entry from the di.