1.

Suppose d = {“john”:40, “peter”:45}, to delete the entry for “john” what command do we use?(a) d.delete(“john”:40)(b) d.delete(“john”)(c) del d[“john”](d) del d(“john”:40)This question was posed to me during an online exam.The above asked question is from Dictionary in chapter Dictionary, Functions and Built-in Functions of Python

Answer»

Right choice is (C) del d[“JOHN”]

Easy EXPLANATION - EXECUTE in the shell to verify.



Discussion

No Comment Found

Related InterviewSolutions