🔍
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)
0 like 0 dislike

1 Answer

c) del d[“john”].
0 like 0 dislike

Related questions

Suppose d = {“john”:40, “peter”:45}. To obtain the number of entries in dictionary which command do we use? a) d.size() b) len(d) c) size(d) d) d.len()
Answer : b) len(d)...

View solution
0 like 0 dislike
1 answer

Suppose d = { john :40, peter :45}, what happens when we try to retrieve a value using the expression d[ susan ]? a) Since susan is not a value in the set, Python raises a KeyError ... Python raises a KeyError exception d) Since susan is not a key in the set, Python raises a syntax error
Answer : c) Since “susan” is not a key in the set, Python raises a KeyError exception...

View solution
0 like 0 dislike
1 answer

What will be the output? d = {"john":40, "peter":45} print(list(d.keys())) a) [“john”, “peter”]. b) [“john”:40, “peter”:45]. c) (“john”, “peter”) d) (“john”:40, “peter”:45)
Answer : a) [“john”, “peter”]....

View solution
0 like 0 dislike
1 answer

What is the output? d = {"john":40, "peter":45} d["john"] a) 40 b) 45 c) “john” d) “peter”
Answer : a) 40...

View solution
0 like 0 dislike
1 answer

What will be the output? d1 = {"john":40, "peter":45} d2 = {"john":466, "peter":45} d1 > d2 a) True b) False c) Error d) None
Answer : c) Error...

View solution
0 like 0 dislike
1 answer

50.5k questions

47.1k answers

240 comments

7.0k users