Key-Value Pair

noun

say it: “KEE VAL-yoo PAIR” /kiː ˈvæljuː ˈpɛr/

One entry in a dictionary: a key, the label, and the value stored under it, such as "phone": "555-0199".

What is a key-value pair?

A key-value pair is one entry in a dictionary: a key (the label) and the value stored under it.

contact = {"name": "Leo", "phone": "555-0199"}
for key, value in contact.items():
    print(key, "=", value)

In a sentence

  • “The loop prints each key-value pair as name = value.”
  • “"tea": 3.0 is one key-value pair in the menu.”

Level: Apprentice · More Python terms at this level

Updated

In other subjects