key-value pair
An entry that links a key, used to look something up, to the value stored for it, such as a user name mapped to a user record.
In more detail
Dictionaries and hash tables store key-value pairs and find a value by its key. Keys must be unique within one table and, in Python, hashable. The value can be anything, including another container.
Related terms
- dictionary — A Python collection that stores values under keys, written in curly brackets, such as {"tea": 250}.
- hash table — A data structure that stores key-value pairs in an array and uses a hash of each key to jump almost directly to its slot.
- hashable — Describes a Python object that has a hash value that never changes during its lifetime and can be compared for equality, so it can be a dict key or set member.
Taught in
- Hash Tables: Chaining, Open Addressing And Load Factor — Algorithms & Data Structures for Working Engineers
- Python Dicts And Sets Under The Hood — Algorithms & Data Structures for Working Engineers
- Dictionaries — Hands-on Python: Complete Video Course & Book
- Dictionaries: Keys, Values And Items — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Collections Sprint — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Sixty Five Minutes, Forty Items: How PCAP Is Run — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Your Own Modules And Packages — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Modules Sprint — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Mock, Review And Exam Day — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
References
- NIST Dictionary of Algorithms and Data Structures: key
- Python tutorial: dictionaries
- Built-in types: dict