Important Notice:

Dictionary

Dictionary

2 views 1 min read

Dictionary  (डिक्शनरी) :-

Dictionary (डिक्शनरी) Python का एक Built-in Data Type है, जिसका उपयोग Key-Value Pair (कुंजी-मान युग्म) के रूप में Data को Store करने के लिए किया जाता है।

Dictionary में प्रत्येक Key (कुंजी) के साथ एक Value (मान) जुड़ी होती है। किसी Value को प्राप्त करने के लिए उसकी संबंधित Key का उपयोग किया जाता है।

Dictionary एक Mutable (परिवर्तनीय), Dynamic (गतिशील) तथा Insertion Ordered (Python 3.7+ में) Data Structure है।

Python में Dictionary को Curly Braces ({}) के अंदर लिखा जाता है। प्रत्येक Key और Value को Colon (:) द्वारा तथा प्रत्येक Key-Value Pair को Comma (,) द्वारा अलग किया जाता है।

महत्वपूर्ण: Dictionary में Data को Index Number से नहीं बल्कि Key के माध्यम से Access किया जाता है।

English

A Dictionary is a Built-in Data Type in Python that is used to store data in the form of Key-Value Pairs.

Each Key in a Dictionary is associated with a Value. The value is accessed using its corresponding key.

A Dictionary is a mutable, dynamic, and insertion ordered (Python 3.7+) data structure.

In Python, a Dictionary is written inside curly braces ({}). Each Key and Value is separated by a colon (:), and each Key-Value Pair is separated by a comma (,).

Important: Dictionary elements are accessed using keys, not index numbers.

 

Syntax :-

dictionary_name = {
    key1: value1,
    key2: value2,
    key3: value3
}
 
Example-
student = {
    "name": "Aman",
    "age": 18,
    "marks": 85
}

print(student)
 
Output-
{'name': 'Aman', 'age': 18, 'marks': 85}
 
 

Related Notes