Python While Loop in Hindi | Complete Python Course 2026 | Episode 19
```html
Python While Loop in Hindi | Complete Python Course 2026 | Episode 19
Python เคฎें While Loop เคเค fundamental concept เคนै เคो เคเคชเคो repeatedly code execute เคเคฐเคจे เคी ability เคฆेเคคा เคนै। เค เคเคฐ เคเคช Python programming เคธीเค เคฐเคนे เคนैं เคคो While Loop เคो เคธเคฎเคเคจा เคฌेเคนเคฆ เคเคฐूเคฐी เคนै। เคเคธ comprehensive guide เคฎें เคนเคฎ While Loop เคो basic level เคธे เคฒेเคเคฐ advanced concepts เคคเค explore เคเคฐेंเคे।
While Loop เค्เคฏा เคนै? (What is While Loop?)
While Loop เคเค control flow statement เคนै เคो เคเคฌ เคคเค specified condition True เคฐเคนเคคी เคนै เคคเคฌ เคคเค code block เคो execute เคเคฐเคคा เคฐเคนเคคा เคนै। เคैเคธे เคนी condition False เคนो เคाเคคी เคนै, loop terminate เคนो เคाเคคा เคนै।
While Loop เคा basic syntax:
while condition:
# code block
# statement 1
# statement 2
While Loop เคैเคธे เคाเคฎ เคเคฐเคคा เคนै?
- เคชเคนเคฒे condition check เคนोเคคी เคนै
- เค
เคเคฐ condition
Trueเคนै เคคो code block execute เคนोเคคा เคนै - Code block เคे เคฌाเคฆ เคซिเคฐ เคธे condition check เคนोเคคी เคนै
- เคเคฌ เคคเค condition
Trueเคฐเคนเคคी เคนै, เคฏเคน process repeat เคนोเคคा เคนै - เคเคฌ condition
Falseเคนो เคाเคคी เคนै, loop exit เคนो เคाเคคा เคนै
Simple While Loop เคा เคเคฆाเคนเคฐเคฃ (Example)
Example 1: 1 เคธे 5 เคคเค เคिเคจเคคी
count = 1
while count <= 5:
print(count)
count = count + 1
Output:
1
2
3
4
5
เคเคธ example เคฎें:
count = 1เคธे เคถुเคฐू เคเคฐเคคे เคนैं- เคเคฌ เคคเค
count <= 5, loop เคเคฒเคคा เคฐเคนेเคा - เคนเคฐ iteration เคฎें
countเคो 1 เคธे increment เคिเคฏा เคाเคคा เคนै - เคเคฌ
count = 6เคนो เคाเคคा เคนै, condition False เคนो เคाเคคी เคนै เคเคฐ loop exit เคนो เคाเคคा เคนै
While Loop เคे เคธाเคฅ String Operations
Example 2: String เคे characters เคो print เคเคฐเคจा
word = "PYTHON"
index = 0
while index < len(word):
print(word[index])
index = index + 1
Output:
P
Y
T
H
O
N
User Input เคे เคธाเคฅ While Loop
Example 3: เคเคฌ เคคเค เคธเคนी answer เคจ เคฆे, เคคเคฌ เคคเค เคชूเคเคคे เคฐเคนें
correct_password = "Python123"
password = ""
while password != correct_password:
password = input("เคชाเคธเคตเคฐ्เคก เคฆเคฐ्เค เคเคฐें: ")
if password == correct_password:
print("เคชाเคธเคตเคฐ्เคก เคธเคนी เคนै!")
else:
print("เคชाเคธเคตเคฐ्เคก เคเคฒเคค เคนै, เคซिเคฐ เคธे เคोเคถिเคถ เคเคฐें।")
เคोเค เคिเคช्เคชเคฃी เคจเคนीं:
เคเค เคिเคช्เคชเคฃी เคญेเคें