Introduction of Python
Getting Started with Python
Syntax in Python
Comment in Python
Variables in Python
Data Types in Python
Numbers in Python
Castings in Python
Strings in Python
Boolean in Python
Operators in Python
List in Python
Tuples in Python
Sets in Python
Dictionary in Python
if Else Statement in Python
While Loop in Python
For Loop in Python
Functions in Python
Lamba Function in Python
Arrays in Python
Classes and Objects in Python
Inheritance in Python
Iterators in Python
Scope in Python
Modules in Python
Dates in Python
Math in Python
JSON in Python
RegEx in Python
Try and Except in Python
User Input in Python
String Formatting in Python
Python While Loop
While loop ka funda ekdum simple hai, jab tak condition true hai wah result ka output generate karta rahega. While loop ko entry control loop bhi bolte hain.
x= 10
while x< 100:
print(x)
x= x + 10
Python me Break statement ka concept
Break Statement ka logic simple hai, agar kisi loop ke break statement ka use hua to wah condition ko check karte hi loop ko break kar dega, fir chahe hi condition true ho.
x= 10
while x< 100:
print(x)
if x == 60:
break
x= x + 10
Python me Continue statement ka concept
Kisi bhi loop ke andar agar Continue Statement ka use kiya gaya hai to wah lagaye gaye condition or uss particular iteration ko skip kar dega aur next value se associated output ko print karega. Example se samajhte hain:
x= 10
while x< 100:
x= x + 10
if x == 60:
continue
print(x)
Diye gaye example me “x” ki value har ek step me 10 times badh rahi hai aur while loop ke condition ke hisab se wah har baar x ki value print karega.
Jaise hi x ki value 60 ke equal hogi waise hi continue staement active hoga aur uss value ko print nhi karega lekin x ki value 60 se 70 ho jayegi, it means ki output kuch aisa hoga: