BCA / B.Tech 7 min read

Dictionary Built-in-method in Hindi

त्वरित सारांश और मुख्य बिंदु

  • • विषय फोकस: Python Notes in Hindi | पायथन नोट्स हिंदी में (BCA / B.Tech Syllabus)
  • • मुख्य विषय: Dictionary Built-in-method in Hindi - General Topics
  • • अवलोकन: Dictionaries in python in Hindi | पाइथन में डीस्नरीस हिंदी में : Python में dictionaries एक शक्तिशाली डेटा संरचना है जो key-value pairs के रूप में ...
  • • मुख्य अवधारणाएं: Python dictionary built in methods, Get keys values items Hindi, Pop dict methods,Python dictionary built in methods, Get keys values items, Pop dict methods

Dictionaries in python in Hindi | पाइथन में डीस्नरीस हिंदी में :

 
  • Python में dictionaries एक शक्तिशाली डेटा संरचना है जो key-value pairs के रूप में डेटा को संग्रहित करने की सुविधा प्रदान करती है।
  •  इसके built-in methods जैसे len(), max(), min(), pop(), clear(), items(), keys(), values(), और update() विभिन्न कार्यों के लिए उपयोगी होते हैं।
  •  इन methods का उपयोग करके, आप dictionaries के साथ आसानी से काम कर सकते हैं और उन्हें manage कर सकते हैं। Python में dictionaries का यह flexibility 
  • उन्हें डेटा प्रबंधन के लिए एक बेहतरीन विकल्प बनाता है
  • Python में dictionaries एक महत्वपूर्ण डेटा संरचना है जो key-value जोड़ों के रूप में डेटा को स्टोर करने के लिए इस्तेमाल होती है। यह unordered, mutable और indexed होती है। 
  • Dictionaries का उपयोग अक्सर डेटा को आसानी से संग्रहीत और पुनः प्राप्त करने के लिए किया जाता है। 

इस लेख में, हम Python dictionaries की विशेषताओं और उनके built-in methods जैसे len(), max(), min(), pop(), clear(), items(), keys(), Values(), और update() पर चर्चा करेंगे।

Dictionaries क्या हैं?

Definition: Dictionary एक unordered collection होती है जो key-value pairs के रूप में डेटा को स्टोर करती है। प्रत्येक key को एक value से जोड़ा जाता है, और key को एक unique identifier के रूप में उपयोग किया जाता है।

Syntax:

my_dict = {
    'key1': 'value1',
    'key2': 'value2',
    'key3': 'value3'
}

Example:

student = {
    'name': 'Ravi',
    'age': 21,
    'subject': 'Computer Science'
}

Built-in Methods :

1. len() Method :

Description: len() method का उपयोग dictionary में key-value pairs की संख्या को प्राप्त करने के लिए किया जाता है।

Syntax:

len(my_dict)
Example:

student = {'name': 'Ravi', 'age': 21}
print(len(student))  # Output: 2

2. max() Method :

Description: max() method का उपयोग dictionary के keys या values में से सबसे बड़ी value प्राप्त करने के लिए किया जाता है।

Syntax:

max(my_dict)
Example:

marks = {'math': 90, 'science': 85, 'english': 95}
print(max(marks.values()))  # Output: 95

3. min() Method :

Description: min() method का उपयोग dictionary के keys या values में से सबसे छोटी value प्राप्त करने के लिए किया जाता है।

Syntax:

min(my_dict)
Example:

marks = {'math': 90, 'science': 85, 'english': 95}
print(min(marks.values()))  # Output: 85

4. pop() Method :

Description: pop() method का उपयोग dictionary से एक key-value pair को हटाने के लिए किया जाता है और वह value को return करता है।

Syntax:

my_dict.pop(key)
Example:
student = {'name': 'Ravi', 'age': 21}
age = student.pop('age')  # age को हटाता है
print(age)  # Output: 21
print(student)  # Output: {'name': 'Ravi'}

5. clear() Method :

Description: clear() method का उपयोग dictionary में से सभी key-value pairs को हटाने के लिए किया जाता है।

Syntax:

my_dict.clear()
Example:

student = {'name': 'Ravi', 'age': 21}
student.clear()
print(student)  # Output: {}

6. items() Method :

Description: items() method का उपयोग dictionary में सभी key-value pairs को tuples के रूप में प्राप्त करने के लिए किया जाता है।

Syntax:

my_dict.items()
Example:

student = {'name': 'Ravi', 'age': 21}
print(student.items())  # Output: dict_items([('name', 'Ravi'), ('age', 21)])

7. keys() Method :

Description: keys() method का उपयोग dictionary में सभी keys को प्राप्त करने के लिए किया जाता है।

Syntax:
my_dict.keys()

Example:

student = {'name': 'Ravi', 'age': 21}
print(student.keys())  # Output: dict_keys(['name', 'age'])

8. values() Method :

Description: values() method का उपयोग dictionary में सभी values को प्राप्त करने के लिए किया जाता है।

Syntax:

my_dict.values()
Example:

student = {'name': 'Ravi', 'age': 21}
print(student.values())  # Output: dict_values(['Ravi', 21])

9. update() Method :

Description: update() method का उपयोग एक dictionary में दूसरी dictionary या key-value pairs को जोड़ने के लिए किया जाता है।

Syntax:

my_dict.update(other_dict)

Example:

student = {'name': 'Ravi', 'age': 21}
student.update({'subject': 'Computer Science'})  # नई key-value जोड़ता है
print(student)  # Output: {'name': 'Ravi', 'age': 21, 'subject': 'Computer Science'}

अक्सर पूछे जाने वाले प्रश्न (FAQs)

Dictionaries in python in Hindi | पाइथन में डीस्नरीस हिंदी में : Python में dictionaries एक शक्तिशाली डेटा संरचना है जो key-value pairs के रूप में डेटा को संग्रहित।
Python Notes in Hindi | पायथन नोट्स हिंदी में के पाठ्यक्रम में Dictionary Built-in-method in Hindi एक महत्वपूर्ण अध्याय है। यह मुख्य सिद्धांतों, परीक्षा प्रश्नों और सूत्रों को समझने के लिए अत्यधिक आवश्यक है।
हाँ, NotesMedia पर आपको Dictionary Built-in-method in Hindi के महत्वपूर्ण प्रश्नोत्तर, हल किए गए उदाहरण और नोट्स बिल्कुल मुफ्त मिलेंगे। अधिक अभ्यास के लिए आप हमारा ऐप भी डाउनलोड कर सकते हैं।