Which of these about a dictionary is false?
A. The values of a dictionary can be accessed using keys
B. The keys of a dictionary can be accessed using values
C. Dictionaries aren't ordered
D. Dictionaries are mutable
Answer: Option B
A. The values of a dictionary can be accessed using keys
B. The keys of a dictionary can be accessed using values
C. Dictionaries aren't ordered
D. Dictionaries are mutable
Answer: Option B
Which of the following data types in Python is used to store key-value pairs?
A. Dictionary
B. List
C. Tuple
D. Set
A. setdefault()
B. addkey()
C. insert()
D. newkey()
What does the len() function do when applied to a dictionary?
A. Returns the number of key-value pairs in the dictionary
B. Returns the sum of all values
C. Returns the length of the longest key
D. Returns the length of the longest value
In Python, how can you get a list of all key-value pairs in a dictionary?
A. items()
B. get_items()
C. all_items()
D. list_items()
Join The Discussion