Question:

What is a key?

Show Hint

In Python dictionaries, keys must be unique while values may be duplicated.
Updated On: Mar 14, 2026
Hide Solution
collegedunia
Verified By Collegedunia

Solution and Explanation

Step 1: Understand the concept of key-value pairs.
In many data structures such as dictionaries or databases, information is stored as pairs of keys and values.
The key acts as an identifier while the value represents the associated data.
Step 2: Example in Python dictionary.
\[ \{ "name":"John",\ age:20 \} \] Here "name" and "age" are keys, while "John" and 20 are their corresponding values.
Step 3: Importance of keys.
Keys allow quick access to stored values and help retrieve information efficiently without searching the entire dataset.
Step 4: Conclusion.
Therefore a key is a unique identifier used to access associated values in data structures or databases.
Was this answer helpful?
0
0