Page 90 - Digicode_AI_class_8
P. 90
Program: To demonstrate the use of while loop with else statement.
On running the above program, you will get the following output:
code Quest Critical Thinking
1. Write the syntax of for the for statement.
2. Write the syntax of while the while statement.
3. Write the output of the following:
a. for num in range(-10, 0, 1):
print(num)
b. count = 0
while (count < 5):
count = count + 1
print("Orange Education")
The jump Statements
Sometimes, there is a situation when the control of the program needs to be transferred out of
the loop body, even if all the values of the iterations of the loop have not been completed. For this
purpose, jumping statements are used in Python. Python offers two jumping statements—break and
continue, which are used within the loop.
88 DigiCode AI-VIII

