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

1 Answer

b) len(d)
0 like 0 dislike

Related questions

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)
Answer : c) del d[“john”]....

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

Which of the following statements create a dictionary? a) d = {} b) d = {“john”:40, “peter”:45} c) d = {40:”john”, 45:”peter”} d) All of the mentioned
Answer : d) All of the mentioned...

View solution
0 like 0 dislike
1 answer

Which of the following statements create a dictionary? a) d = {} b) d = {“john”:40, “peter”:45} c) d = {40:”john”, 45:”peter”} d) All of the mentioned
Answer : Answer: d Explanation: Dictionaries are created by specifying keys and values....

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

50.5k questions

47.1k answers

240 comments

7.0k users