While Loop in Python programming is a control flow statement that allows code to be executed and repeat a specific block of code until the boolean condition is met.
Operators | Type |
---|---|
! | Logical NOT |
* / % | Arithmetic and modulus |
+ - | Arithmetic |
< > <= >= | Relational |
== != | Relational |
&& | Logical AND |
|| | Logical OR |
= | Assignment |
initialise loop counter
while test loop counter using a condition:
do this
and this
increment loop counter
a = 0
while a <= 10: #loop looping from 0 to 10.
print(a) #printing looped value.
a+=1 #adding 1 to 'a' like 'a = a + 1'.