Key-Value Pair (की-वैल्यू पेयर) :-
Key-Value Pair (की-वैल्यू पेयर) का अर्थ Dictionary में Data को Key और उसकी corresponding Value के रूप में Store करना है।
Dictionary में प्रत्येक element एक Key-Value Pair होता है। Key का उपयोग किसी Value की पहचान (Identify) करने के लिए किया जाता है, जबकि Value वह actual Data होता है जिसे Key के साथ Store किया जाता है।
English
A Key-Value Pair means storing data in a Dictionary as a Key and its corresponding Value.
Each element in a Dictionary is a Key-Value Pair. A Key is used to identify a particular Value, while the Value is the actual data stored with the Key.
Syntax -
key: value
Example -
student = {
"name": "Rahul",
"age": 20,
"course": "O Level"
}
print(student)
Output-
{'name': 'Rahul', 'age': 20, 'course': 'O Level'}
यहाँ:
"name" → Key
"Rahul" → Value
"age" → Key
20 → Value
"course" → Key
"O Level" → Value