141k views
5 votes
If you create a keyIterator and a valueIterator for the same dictionary,a. the number of items in keyIterator is smaller than the number of items in valueIteratorb. the number of items in keyIterator is equal to the number of items invalueIteratorc. the number of items in keyIterator is larger than the number of items in valueIteratord. there is no relationship between the number of items in keyIterator and valueIteratore. The dictionary interface supports keyIterator but not valueIterator

User Eckstein
by
5.3k points

1 Answer

5 votes

Answer:

b. the number of items in keyIterator is equal to the number of items invalueIterator

Step-by-step explanation:

A dictionary in python is an unordered and unindexed data structure. It stores data in key-value pairs, this means that for every key in a dictionary, there must be a value. A keys() method is used to create an iterator of dictionary keys. The items of this iterator can be used in a list comprehension, using the dictionary name and the item key to get the values of the dictionary, creating a list of the dictionary values. The values attribute can also be used for this purpose but cannot be used to get the keys.

User Michael Landes
by
5.5k points