In Python, a dictionary can use immutable data types, like strings and tuples, as keys but not _______.
- Arrays
- Dictionaries
- Lists
- Sets
In Python, dictionaries can use immutable data types, such as strings and tuples, as keys because they are hashable and can be used to create unique hash values. However, lists are mutable, and their contents can change, so they cannot be used as dictionary keys.
Loading...
Related Quiz
- How can you detect a cycle in a linked list?
- You are tasked to develop a Flask application that requires user authentication. How would you implement user authentication in a secure manner?
- Consider nested if statements in Python. What could be a potential drawback of having many levels of nested conditions?
- How would you define a variable that can store a lambda function calculating the square of a number in Python?
- What is the primary use of the Pandas library in Python?