Python Continue Statement In Hindi | Python Programming in Hindi

Python Continue Statement In Hindi In Python Programming

Python programming language aaj ke time mein sabse popular aur demand wali programming language ban chuki hai. Iski simplicity aur readability isko beginners se lekar experienced developers tak sabka favorite bana deti hai. Python ke kuch features, jaise ki indentation, clear syntax aur rich library support isko har tarah ke projects ke liye suitable banate hain. Is article mein hum Python continue Statement In Hindi ke baare mein detail mein baat karenge aur samjhenge ki ye kaise use hota hai. Saath hi, hum Python Programming in Hindi se related kuch important concepts ko bhi cover karenge.

Python Continue Statement In Hindi | Python Programming in Hindi
Python Continue Statement In Hindi | Python Programming in Hindi

Python continue Statement Kya Hai?

Python mein continue statement ka use kisi given condition ke according current loop iteration ko skip karne ke liye kiya jata hai. Jab continue statement execute hota hai, toh control loop ke next iteration par jump kar jata hai, bina loop ke baki statements ko execute kiye. Iska matlab hai ki continue statement loop ke beech mein ek condition ke basis par kuch iterations ko skip karne ka tareeka hai.

यह भी पढ़ें: 250+ Free Python Projects with Source Code: From Beginner to Advanced

Example:

for no in range(1, 10):
    if no == 5:
        continue
    print(no)

Output:

1
2
3
4
6
7
8
9

Is example mein, jab no ki value 5 hoti hai, tab continue statement execute hota hai aur loop ki us iteration ko skip kar deta hai. Is wajah se 5 print nahi hota.

Python continue Statement with while Loop

continue statement ko sirf for loop mein hi nahi, balki while loop mein bhi use kiya ja sakta hai. Chaliye ek example dekhte hain:

no = 0
while no < 10:
    no += 1
    if no == 5:
        continue
    print(no)

Output:

1
2
3
4
6
7
8
9
10

Is example mein bhi, jab no ki value 5 hoti hai, tab continue statement execute hota hai aur us iteration ko skip kar diya jata hai.

Important Points to Remember: Python continue Statement

Jab aap continue statement ka use karte hain, to kuch important points hamesha yaad rakhni chahiye:

continue statement ke baad wali statements us iteration ke liye execute nahi hoti.

Agar aap while loop mein continue use kar rahe hain, to ensure karein ki loop variable ko continue statement ke pehle modify karein. Agar aap variable increment ya decrement ko continue ke baad karte hain, to loop endlessly run ho sakta hai.

Incorrect Usage

no = 0
while no < 10:
    if no == 5:
        continue
    no += 1
    print(no)

Yahan pe problem ye hai ki jab no ki value 5 hogi, tab continue statement execute hote hi loop ke next iteration par chala jayega bina no ko increment kiye. Isse loop infinite ho jayega kyunki no ki value kabhi 5 se aage badhegi hi nahi.

Python Programming in Hindi: Loops and Control Statements

Python programming mein loops aur control statements bahut important hote hain. Ye aapko code ko efficient aur readable banane mein madad karte hain. Chaliye for loop, while loop aur kuch common control statements ko detail mein samajhte hain.

For Loop

for loop ka use kisi sequence (jaise list, tuple, string, etc.) ke elements par iterate karne ke liye hota hai. Yeh loop predefined number of times run hota hai.

for item in [1, 2, 3, 4, 5]:
    print(item)

Output:

1
2
3
4
5

Is example mein, list ke har element par for loop iterate karta hai aur unhe print karta hai.

While Loop

while loop tab tak execute hota hai jab tak given condition true raheti hai. Yeh loop kabhi kabhi infinite bhi ho sakta hai agar condition kabhi false na ho.

count = 0
while count < 5:
    print(count)
    count += 1

Output:

0
1
2
3
4

Is example mein, while loop tab tak execute hota hai jab tak count ki value 5 se chhoti hai. Har iteration mein count increment hota hai.

Break Statement

break statement ka use loop ko prematurely terminate karne ke liye kiya jata hai. Jab break statement execute hota hai, to loop immediately terminate ho jata hai aur control loop ke baahar aa jata hai.

for no in range(1, 10):
    if no == 5:
        break
    print(no)

Output:

1
2
3
4

Is example mein, jab no ki value 5 hoti hai, tab break statement loop ko terminate kar deta hai.

Continue Statement

Jaisa ki humne pehle discuss kiya, continue statement loop ke current iteration ko skip karke next iteration par jump kar jata hai.

for no in range(1, 10):
    if no % 2 == 0:
        continue
    print(no)

Output:

1
3
5
7
9

Is example mein, continue statement even numbers ko skip kar deta hai aur sirf odd numbers ko print karta hai.

Python Programming in Hindi: Real-World Examples

Chaliye kuch real-world examples dekhte hain jahan continue statement useful ho sakta hai.

Example 1: Filter Even Numbers

Agar aapko ek list mein se sirf odd numbers print karne hain, to aap continue statement ka use kar sakte hain.

numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
for number in numbers:
    if number % 2 == 0:
        continue
    print(number)

Output:

1
3
5
7
9

Is example mein, continue statement even numbers ko skip kar deta hai.

Example 2: Skip Certain Conditions

Maan lijiye aapko kisi list mein se kuch specific values ko skip karke baaki values ko process karna hai.

values = ['apple', 'banana', 'cherry', 'date', 'elderberry']
skip_values = ['banana', 'date']

for value in values:
    if value in skip_values:
        continue
    print(value)

Output:

apple
cherry
elderberry

Is example mein, continue statement un values ko skip kar deta hai jo skip_values list mein hain.

Advanced Concepts: Python continue Statement

Nested Loops

Python mein nested loops ka matlab hota hai ek loop ke andar doosra loop. Nested loops mein continue statement ka use karna thoda tricky ho sakta hai.

for i in range(1, 4):
    for j in range(1, 4):
        if i == j:
            continue
        print(f'i: {i}, j: {j}')

Output:

i: 1, j: 2
i: 1, j: 3
i: 2, j: 1
i: 2, j: 3
i: 3, j: 1
i: 3, j: 2

Is example mein, continue statement jab i aur j ki value same hoti hai, tab us iteration ko skip kar deta hai.

Continue in Function

Aap continue statement ka use functions ke andar bhi kar sakte hain. Yeh bilkul waise hi kaam karta hai jaise loops mein karta hai.

def print_odd_numbers(numbers):
    for number in numbers:
        if number % 2 == 0:
            continue
        print(number)
print_odd_numbers([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])

Output:

1
3
5
7
9

Is example mein, continue statement even numbers ko skip kar deta hai aur function sirf odd numbers ko print karta hai.

Conclusion: Python continue Statement In Hindi

Is article mein humne "Python continue Statement In Hindi" aur "Python Programming in Hindi" ke concepts ko detail mein samjha. Python ka continue statement loop ke current iteration ko skip karne ke liye use hota hai aur next iteration par jump kar jata hai. Iska use aap for aur while loops mein kar sakte hain. Saath hi humne break statement, nested loops aur functions ke saath continue ka use bhi dekha. Mujhe ummed hai ki aapko ye article pasand aaya hoga aur aap Python programming ko aur bhi acche se samajh payenge.

Python programming seekhne aur use karne mein bahut aasan hai. Agar aap naye programmer hain ya phir experience programmer hain, Python aapko har tarah ke projects mein madad karegi. Continue practice aur experimentation se aap is language ko master kar sakte hain.

यह भी पढ़ें: Python Programming In Hindi | Python Tutorials In Hindi

और नया पुराने

संपर्क फ़ॉर्म