Python List, Tuple, Set, Dictionary in Hindi (2026)
Table of Contents
Toggle
Python में List, Tuple, Set और Dictionary सबसे important data structures हैं। अगर आप beginner हैं और जानना चाहते हैं list kya hai, tuple kya hai, set kya hota hai और dictionary kya hai, तो यह guide आपके लिए है। यहाँ आपको इनके difference और examples आसान हिंदी में मिलेंगे।
👉 List = Ordered + Mutable
👉 Tuple = Ordered + Immutable
👉 Set = Unique + Unordered
👉 Dictionary = Key-Value Pair
Next Step: Python basics और strong करें 🚀
Learn Data Types & VariablesPython में List क्या है? (List in Python in Hindi)
Python में List एक ordered और mutable
data structure है, जिसका उपयोग multiple values को एक ही variable में store करने के लिए किया जाता है।
List को [ ] (square brackets) के अंदर define किया जाता है और values comma से अलग होती हैं।
# Python List Example fruits = ["apple", "banana", "cherry"] print(fruits) # Output: ['apple', 'banana', 'cherry']
💡 Example: List में नया item जोड़ना
fruits = ["apple", "banana", "cherry"]
fruits.append("mango")
print(fruits)
# Output: ['apple', 'banana', 'cherry', 'mango']
Python में Tuple क्या है? (Tuple in Python in Hindi)
Tuple Python का एक ordered और immutable
data structure है, जिसे ( ) parentheses में लिखा जाता है।
List की तरह इसमें indexing होती है, लेकिन इसे modify नहीं किया जा सकता —
इसलिए यह fixed और secure data के लिए best होता है।
# Tuple बनाना t = (10, 20, 30) print(t[0], t[-1]) # 10 30 # Single element tuple t1 = (5) t2 = (5,) print(type(t1), type(t2))
🛠 Common Tuple Operations
t = ("a", "b", "a", "c")
print(len(t)) # 4
print(t.count("a")) # 2
print(t.index("c")) # 3
⚠️ Important Concept
Tuple immutable होता है, लेकिन उसके अंदर मौजूद mutable objects (जैसे list) change हो सकते हैं। Tuple तब use करें जब data fixed हो और security चाहिए।
Next: Dictionary समझें 🚀
Go to DictionaryPython में Set क्या है? (Set in Python in Hindi)
Set Python का एक unordered और unique
data structure है, जिसमें duplicate values allow नहीं होतीं।
Set को { } curly braces में define किया जाता है और इसका उपयोग
fast operations जैसे union, intersection और difference के लिए किया जाता है।
# Set बनाना
numbers = {1, 2, 3, 4}
print(numbers)
# Duplicate हटाना
nums = {1, 2, 2, 3}
print(nums) # Output: {1, 2, 3}
🛠 Common Set Operations
a = {1, 2, 3}
b = {3, 4, 5}
print(a | b) # Union
print(a & b) # Intersection
print(a - b) # Difference
💡 कब use करें?
Set तब use करें जब आपको duplicate हटाने हों, unique values चाहिए हों या fast comparison करना हो।
Next: Dictionary समझें 🚀
Go to DictionaryPython में Dictionary क्या है? (Dictionary in Python in Hindi)
Dictionary Python का एक key-value pair
data structure है, जिसमें data को keys के माध्यम से access किया जाता है।
इसे { } curly braces में define किया जाता है और यह fast lookup के लिए जाना जाता है।
# Dictionary बनाना
student = {
"name": "Rahul",
"age": 22,
"course": "Python"
}
print(student["name"])
🛠 Common Dictionary Operations
student = {"name": "Rahul", "age": 22}
# Add / Update
student["city"] = "Delhi"
# Remove
student.pop("age")
# Access
print(student.get("name"))
💡 कब use करें?
Dictionary तब use करें जब आपको key के आधार पर data access करना हो, जैसे student details, API data या configurations।
अब सबसे important section देखें 🚀
See Difference TablePython List vs Tuple vs Set vs Dictionary (Hindi Difference)
Python में List, Tuple, Set और Dictionary सबसे important data structures हैं। नीचे दिए गए table में आप इनके बीच का difference आसानी से समझ सकते हैं और decide कर सकते हैं कि कब कौन सा use करना है।
| Feature | List | Tuple | Set | Dictionary |
|---|---|---|---|---|
| Order | Ordered | Ordered | Unordered | Unordered |
| Mutability | Mutable | Immutable | Mutable | Mutable |
| Duplicates | Allowed | Allowed | Not Allowed | Keys Unique |
| Access | Index-based | Index-based | No Index | Key-based |
| Syntax | [ ] | ( ) | { } | { key:value } |
| Performance | Flexible | Faster | Fast | Very Fast (O(1)) |
| Best Use | Dynamic data | Fixed data | Unique values | Mapping data |
🧪 Quick Practice
# Remove duplicates using set
nums = [1,2,2,3]
print(list(set(nums)))
# Dictionary example
data = {"name":"Aman","age":22}
print(data["name"])
अब FAQ section देखें (Interview Ready) 🚀
Go to FAQPython List vs Tuple vs Set vs Dictionary – FAQ (Hindi)
यहाँ Python के सबसे common interview questions और beginner doubts के आसान हिंदी में answers दिए गए हैं।
Q1. List और Tuple में क्या फर्क है?
List mutable होती है (change हो सकती है), जबकि Tuple immutable होती है (change नहीं हो सकती)।
Q2. Set क्या होता है Python में?
Set एक unordered data structure है जिसमें duplicate values नहीं होतीं। यह unique values और fast operations के लिए use होता है।
Q3. Dictionary और List में क्या अंतर है?
List में data index से access होता है, जबकि Dictionary में key से access होता है।
Q4. Tuple को List में कैसे convert करें?
Tuple को list में बदलने के लिए list() function use करते हैं:
my_list = list(my_tuple)
Q5. Set और List में क्या difference है?
List ordered होती है और duplicates allow करती है, जबकि Set unordered होता है और duplicates remove कर देता है।
Q6. कब Dictionary use करना चाहिए?
जब data को key → value form में store करना हो और fast lookup चाहिए हो, तब Dictionary best होती है।
Q7. क्या Tuple हमेशा immutable होता है?
Tuple खुद immutable होता है, लेकिन उसके अंदर अगर कोई mutable object (जैसे list) हो तो वह change हो सकता है।
अब practice और MCQs से concepts मजबूत करें 🎯
Start MCQsPython List, Tuple, Set, Dictionary – Quiz
Options पर क्लिक करें, अंत में “Submit Quiz” दबाएँ और score देखें 🎯
