Seedha content par jao
🤖 Python Hindi Bot
Namaste! Main Python Hindi Bot hoon 🐍
Python ya AI se related kuch bhi type karke pucho, ya neeche se quick sawaal chuno.
WhatsApp

Stay Connected with PythonHindii

Join our WhatsApp Community to get the latest Python tutorials, coding tips, interview questions, project updates, and learning resources directly on your phone.

Join WhatsApp Community
⇧
Python Hindi Logo
Python in Hindi | Programming Education
Python programming tutorial in Hindi banner Python code learning illustration Hindi Python student coding illustration Python data code pattern background

Python Tutorial in HindiiLearn Python Programming for Free

Learn Python from Beginner to Advanced in simple Hindi.

print("Namaste Python!")
# Variable banana
naam = "Ankit"
umar = 25
 
for i in range(3):
  print("Sikho!")
 
# Output:
Sikho! Sikho! Sikho!

Why Students Learn Here

📚

Structured Tutorials

Beginner se Advanced tak step-by-step organized lessons.

💻

Practical Code

Real examples aur hands-on code jo actually samajh aaye.

🧠

Python + AI Path

Ek clear roadmap jo Python se AI tak le jaata hai.

🚀

Projects & Career

Portfolio-ready projects aur interview preparation.

Ye Kaise Kaam Karta Hai

Hindi mein Python, AI aur Data Skills seekhne ka sabse simple tareeka.

📘

Seekhein

Beginner se Advanced tak, best curated tutorials aur guides Hindi mein.

💻

Practice Karein

Real code examples aur mini-projects ke through hands-on practice karein.

💬

Judein

WhatsApp community se judkar apne doubts clear karein, akele nahi seekhenge.

Python to AI Learning Roadmap

Step-by-step learning path from Python basics to AI, Data Science and career-ready projects.

1
🐍

Python Basics

Introduction, Variables, Data Types, Operators, Input & Output, Conditions, Loops, Functions

Start Python →
2
💻

Python Intermediate

Lists, Tuples, Sets, Dictionaries, Strings, Functions, Modules, File Handling, Exception Handling

Continue Python →
3
⚙️

Advanced Python

OOP, Iterators, Generators, Decorators, Regular Expressions, APIs, Automation, Virtual Environments

Learn Advanced Python →
4
🗄️

SQL & Databases

SQL Basics, MySQL, SELECT, INSERT, UPDATE, DELETE, JOIN, GROUP BY, Database Projects

Learn SQL →
5
📊

Data Analytics

NumPy, Pandas, Data Cleaning, Data Visualization, Matplotlib, Exploratory Data Analysis

Learn Data Analytics →
6
🤖

Machine Learning

ML Basics, Supervised & Unsupervised Learning, Regression, Classification, Model Evaluation, Scikit-learn

Learn Machine Learning →
7
🧠

Artificial Intelligence

AI Fundamentals, Generative AI, AI Tools, Prompt Engineering, LLM Concepts, AI Automation

Explore AI →
8
🚀

Projects & Career

Python Projects, AI Projects, Data Projects, Portfolio, GitHub, Interview Preparation, Career Roadmap

Build Your Career →

Python Tuple क्या है? | Tuples in Python Explained in Hindi | Complete Python Course

Python Tuple in Hindi - Complete Python Course

Python Tuple

Python में जब हमें कई values को एक साथ रखना हो, लेकिन उन values को बाद में बदलने की जरूरत न हो, तो Python का Tuple data structure इस्तेमाल होता है। Tuple List जैसा ही दिखता है, लेकिन इसमें एक बहुत बड़ा फर्क है — Tuple को एक बार बनाने के बाद modify नहीं किया जा सकता।

अगर आपने अभी Python Strings in Hindi नहीं पढ़ा है, तो पहले वो article पढ़ना उपयोगी रहेगा, क्योंकि indexing का concept वहीं से carry होता है। Examples खुद run करने के लिए हमारा Online Python Editor & Compiler use कर सकते हैं।

🎥 Video में पूरा Topic समझें

Python Tuple क्या है?

Tuple Python का एक data structure है, जिसमें एक साथ कई values को एक क्रम (order) में रखा जाता है — बिल्कुल list जैसा, लेकिन इसे ( ) round brackets में लिखा जाता है और इसकी values को बाद में बदला नहीं जा सकता।

सरल भाषा में — Tuple एक ऐसी list है जिसे एक बार बनाने के बाद freeze कर दिया गया हो।
Example
fruits = ("apple", "banana", "mango") print(fruits)

Output:

('apple', 'banana', 'mango')
Try it Yourself »

Tuple की जरूरत क्यों पड़ती है?

जब हमें ऐसा data रखना हो जो program के दौरान कभी बदलना ही नहीं चाहिए — जैसे किसी व्यक्ति की जन्मतिथि, किसी देश के coordinates, या fixed configuration values — तो Tuple एक अच्छा choice है, क्योंकि यह accidental changes से data को सुरक्षित रखता है।

  • Data को सुरक्षित रखना — गलती से भी values बदली नहीं जा सकतीं
  • Fixed data के लिए उपयुक्त — जैसे coordinates, dates, constant values
  • List से थोड़ा तेज — Tuple immutable होने की वजह से processing में हल्का हल्का faster होता है

Tuple Create कैसे करें?

Tuple बनाने के लिए values को round brackets ( ) के अंदर, comma से अलग करके लिखा जाता है।

Syntax
tuple_name = (value1, value2, value3)
Example
numbers = (10, 20, 30, 40) print(numbers)

Output:

(10, 20, 30, 40)
Try it Yourself »

Tuple में Multiple Values Store करना

Example
colors = ("red", "green", "blue", "yellow") print(colors) print(len(colors))

Output:

('red', 'green', 'blue', 'yellow') 4
Try it Yourself »

Different Types की Values Store करना

List की तरह, Tuple में भी अलग-अलग data types की values एक साथ रखी जा सकती हैं।

Example
mixed_tuple = ("Ankit", 25, True, 5.5) print(mixed_tuple)

Output:

('Ankit', 25, True, 5.5)
Try it Yourself »

Positive Indexing

List की तरह Tuple में भी counting 0 से शुरू होती है।

fruits = ("apple", "banana", "mango", "orange") Index → 0 1 2 3
Example
fruits = ("apple", "banana", "mango", "orange") print(fruits[0]) print(fruits[2])

Output:

apple mango
Try it Yourself »

Negative Indexing

Negative indexing में counting आखिर से होती है — last element का index -1 होता है।

fruits = ("apple", "banana", "mango", "orange") Index → -4 -3 -2 -1
Example
fruits = ("apple", "banana", "mango", "orange") print(fruits[-1]) print(fruits[-2])

Output:

orange mango
Try it Yourself »

Tuple Elements को Access करना

Example
student = ("Ankit", 25, "Lucknow") print("Name:", student[0]) print("Age:", student[1]) print("City:", student[2])

Output:

Name: Ankit Age: 25 City: Lucknow
Try it Yourself »

Tuple Immutable क्या होता है?

Immutable का मतलब है — एक बार बन जाने के बाद जिसे बदला न जा सके। Tuple की सबसे बड़ी पहचान यही है कि यह immutable होता है।

सरल भाषा में — Tuple बनने के बाद उसके elements को add, remove या update नहीं किया जा सकता।
Note: List mutable होती है (बदली जा सकती है), जबकि Tuple immutable होता है (बदला नहीं जा सकता) — यही दोनों में सबसे मुख्य फर्क है।

Tuple को Modify क्यों नहीं कर सकते?

Example — यह error देगा
fruits = ("apple", "banana", "mango") fruits[1] = "grapes" # TypeError

Output:

TypeError: 'tuple' object does not support item assignment

Python यहाँ जानबूझकर error देता है, क्योंकि Tuple को design ही इस तरह किया गया है कि उसका data एक बार set होने के बाद सुरक्षित रहे — यही चीज़ इसे उन जगहों के लिए उपयुक्त बनाती है जहाँ data fixed रहना चाहिए, जैसे date of birth या geographic coordinates।

Single Element Tuple का सही Syntax

अगर Tuple में सिर्फ एक ही value रखनी हो, तो उसके बाद एक comma लगाना जरूरी है — वरना Python उसे Tuple नहीं मानेगा।

❌ गलत — यह Tuple नहीं बनेगा
single = ("apple") print(type(single))

Output:

<class 'str'>

बिना comma के Python इसे सिर्फ एक string मानता है, Tuple नहीं।

✅ सही — comma के साथ
single = ("apple",) print(type(single))

Output:

<class 'tuple'>
Try it Yourself »

len() से Tuple की Length निकालना

Example
fruits = ("apple", "banana", "mango", "orange") print(len(fruits))

Output:

4
Try it Yourself »

in से Element Check करना

Example
fruits = ("apple", "banana", "mango") print("banana" in fruits) print("grapes" in fruits)

Output:

True False
Try it Yourself »

Tuple Unpacking

Unpacking से Tuple की values को एक साथ अलग-अलग variables में assign किया जा सकता है।

Example
student = ("Ankit", 25, "Lucknow") name, age, city = student print(name) print(age) print(city)

Output:

Ankit 25 Lucknow

यहाँ Tuple के तीनों values एक ही line में तीन अलग-अलग variables — name, age, city — में चली गईं।

Try it Yourself »
Note: Unpacking करते समय variables की संख्या Tuple के elements की संख्या के बराबर होनी चाहिए, वरना Python error देगा।

count() Method

count() बताता है कि कोई value Tuple में कितनी बार आई है।

Example
numbers = (1, 2, 3, 2, 4, 2, 5) print(numbers.count(2))

Output:

3
Try it Yourself »

index() Method

index() किसी value की पहली position (index) बताता है।

Example
fruits = ("apple", "banana", "mango") print(fruits.index("mango"))

Output:

2
Try it Yourself »
Methodकाम
len(tuple)Tuple की length बताता है
value in tupleValue मौजूद है या नहीं, check करता है
tuple.count(value)Value कितनी बार आई है, बताता है
tuple.index(value)Value की पहली position बताता है

Practical Student Information Example

Example
student_info = ("Ankit", 25, "Lucknow", "Python") name, age, city, course = student_info print("Name:", name) print("Age:", age) print("City:", city) print("Course:", course) print("Total Info Items:", len(student_info)) print("Is 'Python' in tuple:", "Python" in student_info)

Output:

Name: Ankit Age: 25 City: Lucknow Course: Python Total Info Items: 4 Is 'Python' in tuple: True

यहाँ एक ही Tuple में किसी student की पूरी जानकारी रखी गई और उसे unpacking से आसानी से अलग-अलग variables में निकाला गया।

Try it Yourself »

Common Tuple Mistakes

❌ Tuple को Modify करने की कोशिश करना
fruits = ("apple", "banana") fruits[0] = "grapes" # TypeError
✅ अगर बदलना जरूरी हो, तो List इस्तेमाल करें
fruits = ["apple", "banana"] fruits[0] = "grapes"
❌ Single Element Tuple में Comma भूल जाना
single = ("apple") print(type(single)) #
✅ सही तरीका
single = ("apple",) print(type(single)) #
❌ Unpacking में Variables की संख्या मैच न करना
student = ("Ankit", 25, "Lucknow") name, age = student # ValueError: too many values to unpack
✅ सही तरीका
name, age, city = student
❌ List और Tuple के Brackets को Confuse करना

List [ ] square brackets में बनती है और mutable होती है, जबकि Tuple ( ) round brackets में बनता है और immutable होता है।

Exercise ?

Tuple बनने के बाद उसके elements के साथ क्या किया जा सकता है?

Add, remove और update — तीनों
सिर्फ access और read करना
सिर्फ update करना

Coding Challenge

अब खुद अपने Online Python Editor में इन challenges को solve कीजिए:

  1. अपने 4 favorite cities के नामों की एक tuple बनाइए और उसे print कीजिए।
  2. Positive और negative indexing से पहले और आखिरी city print कीजिए।
  3. एक single-element tuple बनाइए (सही comma syntax के साथ) और उसका type() check कीजिए।
  4. एक tuple में किसी number को कई बार रखिए और count() से पता कीजिए कि वह कितनी बार आया है।
  5. Tuple unpacking से किसी 3-value वाली tuple को तीन अलग variables में split कीजिए और उन्हें print कीजिए।

Quick Revision

ConceptSyntax / Example
Tuple बनानाfruits = ("apple", "banana")
Positive Indexingfruits[0] → पहला element
Negative Indexingfruits[-1] → आखिरी element
ImmutableElements को modify नहीं किया जा सकता
Single Element Tuplesingle = ("apple",)
len()Tuple की length बताता है
inElement मौजूद है या नहीं, check करता है
Unpackinga, b, c = my_tuple
count()Value कितनी बार आई है, बताता है
index()Value की पहली position बताता है

FAQ

Python में Tuple क्या है?

Tuple Python का एक data structure है जिसमें कई values को एक क्रम में रखा जाता है, लेकिन एक बार बनने के बाद उसकी values को बदला नहीं जा सकता।

Tuple और List में मुख्य फर्क क्या है?

List mutable होती है (values बदली जा सकती हैं) और [ ] में बनती है, जबकि Tuple immutable होता है (values नहीं बदली जा सकतीं) और ( ) में बनता है।

Single element वाला Tuple बनाते समय comma क्यों जरूरी है?

बिना comma के Python ("apple") को सिर्फ एक string मानता है, Tuple नहीं। Comma के साथ ("apple",) लिखने से ही Python उसे Tuple की तरह पहचानता है।

Tuple Unpacking क्या है?

Tuple Unpacking वह तरीका है जिससे Tuple की सारी values एक ही line में अलग-अलग variables में assign की जा सकती हैं, जैसे name, age, city = student।

Tuple कब इस्तेमाल करना चाहिए?

जब आपके पास ऐसा data हो जो program के दौरान बदलना ही नहीं चाहिए — जैसे coordinates, date of birth, या कोई fixed configuration — तब Tuple एक बेहतर choice है।

Summary

Tuple = एक ऐसी List, जिसे बनने के बाद फिर बदला नहीं जा सकता।

इस article में आपने सीखा कि Python Tuple क्या है, इसे कैसे बनाते हैं, positive और negative indexing कैसे काम करते हैं, Tuple immutable क्यों होता है, single element tuple का सही syntax क्या है, और len(), in, unpacking, count() व index() जैसे common operations कैसे इस्तेमाल होते हैं।

Tuple उन जगहों के लिए perfect है जहाँ data को accidental changes से बचाना जरूरी हो। अब ऊपर दिया गया coding challenge खुद अपने Online Editor में solve करें।

Related Articles

🧑‍💻 Python Coding Lab Python code likho, run karo aur practice karo — directly browser mein.