Which method would you use to get a list of all the keys in a dictionary?
- d.items()
- d.keylist()
- d.keys()
- d.values()
To get a list of all the keys in a dictionary 'd', you would use the d.keys() method. It returns a list of all the keys present in the dictionary.
Loading...
Related Quiz
- To create a module in Python, you need to write your functions, classes, and variables in a _______ file.
- You are implementing a caching mechanism. You need a data structure that removes the least recently added item when the size limit is reached. Which built-in Python data structure would you use?
- For method overriding to occur, the method in the derived class must have the same _______ and return type as the method in the base class.
- Which Python data structure is suitable for storing multiple data types and allows duplicate elements?
- You are tasked with creating a predictive model to forecast stock prices. Which type of machine learning model would be most appropriate for this task?