Python while Keyword
The Python while keyword is used to create a while loop. The While loop allows a set of statements to be executed repeatedly until a given condition is true.
while condition: statements
In below mentioned example, program uses while loop to sum all integers from 1 to 5.
sum = 0 i = 1 while (i < 6): sum = sum + i i = i+1 print(sum)
The output of the above code will be:
❮ Python Keywords