Page 79 - Code Craft Computer-8
P. 79
You will get the following output:
Extra Bytes
Any non-zero value in the while loop indicates always a true condition, whereas
zero indicates always–false condition.
The While Loop Using Else Statement
Python enables the use of else statement with the while loop. The else block is executed when the
condition given in the while statement becomes false.
Program 8: To demonstrate the use of while loop with else statement.
On running the above program, we get the following output:
INFINITE LOOP
If the condition given in a loop never becomes false, then the loop will never terminate and run
indefinitely. This type of loops is called an infinite loop.
79

