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
🎓 100% Free · Hindi me · Beginner se Career tak

Python Tutorial in HindiiLearn Python Programming for Free

Python, AI, Data Analytics aur SQL ek hi jagah, simple Hindi me. Padho, browser me code chalao, projects banao aur career shuru karo.

main.py
# Python seekho, Hindi me naam = "Ravi" for i in range(3): print("Namaste", naam)
▸ python main.py
🐍 Python 🤖 AI & ML 📊 Data 🗄️ SQL

Chahe Student ho ya Professional, yahan aapke liye sab hai

Apna card chuno, seedha sahi jagah pahunch jaoge.

🎓

Student ho?

School ya college me ho? Python zero se seekho, notes aur cheat sheets ke saath.

  • Python basics se OOP tak
  • Notes, PDFs aur Cheat Sheets
  • Browser me practice, kuch install nahi
💼

Working Professional ho?

Kaam ke saath nayi skill jodo: data, SQL aur AI se apna kaam tez karo.

  • Pandas, NumPy, Excel, Power BI
  • SQL aur MySQL databases
  • Automation aur AI Tools
🚀

Job ya Career change?

Projects banao, interview ki taiyari karo aur sahi roadmap follow karo.

  • Real projects, portfolio ke liye
  • Python aur SQL interview questions
  • AI Engineer, Data Scientist roadmap

Python Hindii Kaise Kaam Karta Hai?

Ek hi jagah 4 layers: seekho, practice karo, skills banao aur career shuru karo. Har layer ek step hai, us par click karke seedha wahan pahuncho. Computer par drag karke 3D me ghumao bhi.

Layer 1 · Seekho

Python Basics se Advanced tak

Variables, loops, functions se OOP tak, sab simple Hindi me. Yahin se shuru karo.

Naye ho? 3 step me shuru karo

💻 Online Code Editor

Browser me hi code likho aur turant chalao

Koi software install nahi. Code likho, Run dabao aur result usi waqt dekho.

  • Python, Java, C, C++, JavaScript, HTML aur aur bhi languages
  • input(), graphs aur multi-file HTML project bhi chalte hain
  • Mobile aur computer, dono par chalta hai
main.py
naam = input("Naam batao: ") for i in range(3): print("Namaste", naam)
▸ python main.py
PythonJavaCC++JavaScriptHTML

Python se AI tak ka poora rasta

8 steps, ek ke baad ek. Aage-peeche ghumao aur apni stage se seedha shuru karo.

Step 1 🐍

Python Basics

IntroductionVariablesData TypesOperatorsInput & OutputConditionsLoops
Start Python →
Step 2 💻

Python Intermediate

ListsTuplesSetsDictionariesStringsModulesFile Handling
Continue Python →
Step 4 🗄️

SQL & Databases

SQL BasicsMySQLSELECTINSERTUPDATEDELETEJOIN
Learn SQL →
Step 5 📊

Data Analytics

NumPyPandasData CleaningData VisualizationMatplotlibExploratory Data Analysis
Learn Data Analytics →
Step 6 🤖

Machine Learning

ML BasicsSupervised & Unsupervised LearningRegressionClassificationModel EvaluationScikit-learn
Learn Machine Learning →
Step 7 🧠

Artificial Intelligence

AI FundamentalsGenerative AIAI ToolsPrompt EngineeringLLM ConceptsAI Automation
Explore AI →
Step 8 🚀

Projects & Career

Python ProjectsAI ProjectsData ProjectsPortfolioGitHubInterview PreparationCareer Roadmap
Build Your Career →
Step 1 / 8

Python For Loop in Hindi सीखें आसान examples के साथ। Iteration, range() & enumerate() Complete Guide

Python For Loop in Hindi - Iteration range() enumerate() Complete Guide

Python For Loop in Hindi: Iteration, range() और enumerate() Complete Guide

जब भी कोई नया सीखने वाला Python की दुनिया में कदम रखता है, तो कुछ concepts ऐसे होते हैं जिनके बिना आगे बढ़ना मुश्किल हो जाता है — और For Loop उनमें सबसे ऊपर आता है। किसी list के सारे elements को print करना हो, किसी काम को बार-बार दोहराना हो, या किसी sequence को एक-एक करके पढ़ना हो — for loop यही काम बहुत आसानी से कर देता है।

सोचिए आपके पास 5 students के नाम हैं और आपको हर नाम print करना है। एक-एक करके 5 बार print() लिखना ठीक नहीं लगता — यही वो जगह है जहाँ for loop काम आता है।

इस guide में हम step by step समझेंगे:

  • Python For Loop क्या है और यह कैसे काम करता है
  • Iteration का मतलब क्या होता है
  • range() function और इसके तीनों forms
  • enumerate() function
  • List, String और Tuple पर for loop
  • Nested for loop
  • break और continue
  • Practical Python programs और beginners की common गलतियाँ

अगर आप Python बिल्कुल शुरुआत से सीख रहे हैं, तो पहले हमारा Python Tutorial in Hindi एक बार जरूर देख लीजिए, उससे बाकी basics भी क्लियर हो जाएँगे।


Python For Loop क्या है?

For loop Python का एक control flow statement है जिसका उपयोग किसी iterable object के elements को एक-एक करके access करने और उनपर कोई operation perform करने के लिए किया जाता है।

आसान भाषा में कहें तो — for loop किसी भी sequence या collection के हर item पर बारी-बारी से code चलाता है।

names = ["Rahul", "Aman", "Priya"]

for name in names:
    print(name)

Output:

Rahul
Aman
Priya

यहाँ Python ने list के तीनों elements को एक-एक करके name variable में रखा और print() statement तीन बार चलाया। यही process iteration कहलाती है।

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

Iteration का मतलब है किसी collection या sequence के elements को एक-एक करके access करना।

numbers = [10, 20, 30, 40]

for number in numbers:
    print(number)
10
20
30
40

Python में lists, tuples, strings, sets और dictionaries जैसे कई iterable objects पर iteration की जा सकती है।

Python For Loop का Syntax

for variable in iterable:
    # code
  • for → Python का loop keyword है
  • variable → current item को temporarily store करता है
  • in → iterable से item लेने के लिए इस्तेमाल होता है
  • iterable → list, tuple, string, range वगैरह हो सकता है
  • : → loop block की शुरुआत बताता है
  • indented code → हर iteration में execute होता है

For Loop कैसे काम करता है? (Step by Step)

fruits = ["Apple", "Mango", "Banana"]

for fruit in fruits:
    print(fruit)

Python internally कुछ इस तरह काम करता है:

पहला iteration: fruit = "Apple" → Output: Apple
दूसरा iteration: fruit = "Mango" → Output: Mango
तीसरा iteration: fruit = "Banana" → Output: Banana

जब सारे elements process हो जाते हैं, तो loop अपने आप खत्म हो जाता है।

Python For Loop with List

students = ["Ankit", "Rahul", "Priya", "Neha"]

for student in students:
    print(student)
Ankit
Rahul
Priya
Neha

यह तरीका तब बहुत useful होता है जब आपके पास कई values हों और हर value पर कोई operation perform करना हो। अगर आप Python Lists थोड़ी detail में समझना चाहते हैं, तो हमारे Python Tutorial in Hindi में पूरा learning path दिया गया है।

String के साथ For Loop

Python में string भी iterable होती है, इसलिए हम उसके हर character को for loop से access कर सकते हैं।

name = "Python"

for letter in name:
    print(letter)
P
y
t
h
o
n

Tuple के साथ For Loop

colors = ("Red", "Green", "Blue")

for color in colors:
    print(color)
Red
Green
Blue

इसलिए Python में iterable objects के साथ for loop बहुत flexible है।

Python range() Function क्या है?

Python में range() function का उपयोग numbers की sequence generate करने के लिए होता है, और for loop के साथ इसका सबसे common use numbers को repeat करने के लिए होता है।

for i in range(5):
    print(i)
0
1
2
3
4

ध्यान दें: range(5) में 5 शामिल नहीं होता — यह sequence 0 से शुरू होकर 4 तक जाती है।

range() का Syntax — तीन Forms

Python में range() के तीन common forms हैं:

range(stop)
range(start, stop)
range(start, stop, step)

1. range(stop)

for i in range(5):
    print(i)
0
1
2
3
4

2. range(start, stop)

for i in range(2, 7):
    print(i)
2
3
4
5
6

याद रखने का आसान तरीका: start → included, stop → excluded

3. range(start, stop, step)

step बताता है कि हर iteration में number कितना बढ़ेगा या घटेगा।

for i in range(0, 10, 2):
    print(i)
0
2
4
6
8

Negative Step के साथ range()

for i in range(10, 0, -1):
    print(i)
10
9
8
7
6
5
4
3
2
1

इसका उपयोग countdown जैसे programs में किया जा सकता है।

1 से 10 तक Numbers Print करना

for i in range(1, 11):
    print(i)

ध्यान दें हमें 11 देना पड़ा क्योंकि range() का stop value include नहीं होता।

Even और Odd Numbers Print करना

Even numbers:

for i in range(2, 21, 2):
    print(i)

Odd numbers:

for i in range(1, 20, 2):
    print(i)

Python For Loop और enumerate() Function

कई बार हमें list के साथ item की value और उसका index दोनों एक साथ चाहिए होते हैं। यही काम enumerate() बहुत आसानी से कर देता है।

students = ["Ankit", "Rahul", "Priya"]

for index, student in enumerate(students):
    print(index, student)
0 Ankit
1 Rahul
2 Priya

enumerate() में Index 1 से शुरू करना

for index, student in enumerate(students, start=1):
    print(index, student)
1 Ankit
2 Rahul
3 Priya

यह तरीका menus, ranking, numbered lists और reports बनाने में काफी useful है।

For Loop में if Condition का उपयोग

numbers = [10, 15, 20, 25, 30]

for number in numbers:
    if number > 20:
        print(number)
25
30

अगर आप Python conditions को और अच्छे से समझना चाहते हैं, तो Python Tutorial in Hindi से बाकी basics भी पढ़ सकते हैं।

break और continue Statement

break loop को तुरंत stop कर देता है:

for i in range(1, 10):
    if i == 5:
        break
    print(i)
1
2
3
4

continue current iteration को skip करके अगली iteration पर चला जाता है:

for i in range(1, 6):
    if i == 3:
        continue
    print(i)
1
2
4
5
Statementकाम
breakपूरा loop बंद करता है
continueसिर्फ current iteration skip करता है

Nested For Loop क्या है?

जब एक for loop के अंदर दूसरा for loop होता है, उसे Nested For Loop कहते हैं।

for i in range(1, 4):
    for j in range(1, 4):
        print(i, j)

Star Pattern Example:

for i in range(1, 6):
    for j in range(i):
        print("*", end=" ")
    print()
*
* *
* * *
* * * *
* * * * *

Nested loops शुरू में थोड़े confusing लग सकते हैं, इसलिए पहले normal for loop और range() पर अच्छी practice करना बेहतर है।

Practical Python Programs

Multiplication Table

number = 5

for i in range(1, 11):
    print(number, "x", i, "=", number * i)

List का Sum निकालना

numbers = [10, 20, 30, 40, 50]
total = 0

for number in numbers:
    total = total + number

print("Total =", total)

Maximum Number Find करना

numbers = [12, 45, 23, 67, 34]
maximum = numbers[0]

for number in numbers:
    if number > maximum:
        maximum = number

print("Maximum =", maximum)

ऐसी छोटी-छोटी problems logic building के लिए काफी useful हैं। अगर आपको एक real project देखना है जिसमें ऐसी ही logic इस्तेमाल हुई है, तो हमारा Sales Data Analysis Project in Python जरूर देखें।

Python For Loop में else

for i in range(5):
    print(i)
else:
    print("Loop completed")

Loop सामान्य रूप से पूरा होने पर else execute होता है। लेकिन अगर loop को break से terminate किया जाए, तो else execute नहीं होता।

Beginners की Common Mistakes

1. Colon भूल जाना

गलत: for i in range(5) — सही: for i in range(5):

2. Indentation गलत करना

Python में indentation बहुत important है। गलत indentation से IndentationError आ सकता है।

3. range() में stop value को include समझना

range(1, 5) का output 1, 2, 3, 4 होता है — 5 इसमें शामिल नहीं है।

4. Variable का गलत नाम इस्तेमाल करना

# गलत
for name in names:
    print(student)

# सही
for name in names:
    print(name)

For Loop और While Loop में Difference

Feature For Loop While Loop
मुख्य उपयोगIterable/sequence पर iterationCondition के आधार पर repetition
Common useList, String, RangeUnknown repetitions
Syntaxfor x in datawhile condition
Infinite loop का riskकमज्यादा

Python For Loop का Real-World Use

For loop सिर्फ छोटे programming examples के लिए नहीं है — real-world applications में भी इसका बहुत ज्यादा इस्तेमाल होता है:

  • Data Processing — हजारों records को process करना
  • Web Development — multiple users, products या records पर operations
  • Data Analysis — data को iterate करके filtering और calculations
  • Automation — repeated tasks automate करना
  • Machine Learning — data preprocessing और computational tasks

अगर आपका goal Data Analyst या Python Developer बनना है, तो सिर्फ syntax याद करने के बजाय practical examples पर practice करना ज्यादा जरूरी है। इसके लिए हमारा Sales Data Analysis Project in Python एक बार जरूर try करें।

Practice Questions

Beginner Level:

  1. 1 से 20 तक numbers print करें
  2. 1 से 50 तक even numbers print करें
  3. 1 से 50 तक odd numbers print करें
  4. किसी number की multiplication table print करें
  5. एक list के सारे elements print करें
  6. किसी string के सारे characters print करें

Intermediate Level:

  1. List का total निकालें
  2. List में maximum number find करें
  3. List में minimum number find करें
  4. List में कितने even numbers हैं, count करें
  5. enumerate() का उपयोग करके numbered list print करें
  6. Nested loop की मदद से star pattern बनाएं

Challenge:

  1. List में duplicate values identify करने का program बनाएं
  2. किसी string में vowels की संख्या count करें
  3. 1 से 100 तक सिर्फ वे numbers print करें जो 3 और 5 दोनों से divisible हों

इन exercises को खुद लिखकर run करना Python सीखने का सबसे अच्छा तरीका है।

Python For Loop सीखने के बाद क्या पढ़ें?

अगर आपने for loop, range() और enumerate() समझ लिया है, तो अब आपको Python के दूसरे core concepts की तरफ बढ़ना चाहिए:

Python Basics → Variables → Data Types → Operators → Conditions → For Loop → While Loop → Functions → Lists → Tuples → Dictionaries → Sets → File Handling → Exception Handling → OOP

पूरी structured learning के लिए Python Tutorial in Hindi को bookmark कर सकते हैं।

Quick Revision

इस पूरे tutorial में हमने सीखा:

  • for loop क्या है
  • Iteration और iterable क्या होते हैं
  • List और String के साथ for loop
  • range() function और इसके forms
  • Negative step
  • enumerate() function
  • break और continue
  • Nested for loop
  • for loop के साथ if और else
  • Common mistakes और for vs while का difference

सबसे important बात यह है कि for loop को सिर्फ definition से याद न करें — खुद code लिखें, values बदलें और output को observe करें।

Frequently Asked Questions (FAQs)

Python For Loop क्या है?
Python For Loop एक control flow statement है जिसका उपयोग iterable object के elements पर एक-एक करके code execute करने के लिए किया जाता है।

Python में for loop क्यों इस्तेमाल किया जाता है?
For loop का उपयोग repetitive tasks, lists या strings के elements को process करने और sequences पर iteration करने के लिए होता है।

Python में range() क्या है?
range() Python का built-in function है जो numbers की sequence generate करता है और इसे अक्सर for loop के साथ इस्तेमाल किया जाता है।

क्या range() में stop number शामिल होता है?
नहीं। range() में stop value शामिल नहीं होती। उदाहरण के लिए range(1, 5) में values 1, 2, 3, 4 होंगी।

enumerate() का उपयोग क्यों किया जाता है?
enumerate() का उपयोग iterable के item के साथ उसका index भी प्राप्त करने के लिए किया जाता है।

break और continue में क्या अंतर है?
break पूरे loop को समाप्त करता है, जबकि continue केवल current iteration को skip करके अगले iteration पर चला जाता है।

क्या Python में for loop के साथ else इस्तेमाल कर सकते हैं?
हाँ। Python में for loop के साथ else इस्तेमाल किया जा सकता है। Loop सामान्य रूप से पूरा होने पर else block execute होता है।

Conclusion

Python For Loop Python programming का एक fundamental concept है। अगर आप Python को seriously सीखना चाहते हैं, तो for loop, iteration, range() और enumerate() को अच्छी तरह समझना जरूरी है।

शुरुआत में simple examples से practice करें, फिर list, string, conditions, nested loops और practical programs की तरफ बढ़ें। एक बार आपको यह समझ आ जाए कि loop हर iteration में क्या कर रहा है, तब Python programming की logic काफी आसान लगने लगती है।

Practice → Build Projects → Learn from Errors → Improve 🚀


Related Python Tutorials

🧑‍💻 Python Coding Lab

Python code likho, run karo aur practice karo — directly browser mein.