Python Test 9 - Dictionary

Which of the following statements create a dictionary?
What will be the output of the following Python code snippet?
d = {"john":40, "peter":45}
What will be the output of the following Python code snippet?
d = {"john":40, "peter":45}
"john" in d
What will be the output of the following Python code snippet?
d1 = {"john":40, "peter":45}
d2 = {"john":466, "peter":45}
d1 == d2
What will be the output of the following Python code snippet?
d1 = {"john":40, "peter":45}
d2 = {"john":466, "peter":45}
d1 > d2
What will be the output of the following Python code snippet?
d = {"john":40, "peter":45}
d["john"]
Suppose d = {“john”:40, “peter”:45}, to delete the entry for “john” what command do we use?
Suppose d = {“john”:40, “peter”:45}. To obtain the number of entries in dictionary which command do we use?
What will be the output of the following Python code snippet?
d = {"john":40, "peter":45}
print(list(d.keys()))
Suppose d = {“john”:40, “peter”:45}, what happens when we try to retrieve a value using the expression d[“susan”]?
Schreibe einen Kommentar