How to make use of while loop in python and what is its syntax?
Answers
Answered by
0
The syntax of a while loop in Python is −
while expression:
statement(s)
hope it helps
Answered by
0
Answer:
With the while loop we can execute a set of statements as long as a condition is true.
1) Print i as long as i is less than 6: i = 1. while i < 6: ...
2) Exit the loop when i is 3: i = 1. while i < 6: ...
3) Continue to the next iteration if i is 3: i = 0. while i < 6: ...
4) Print a message once the condition is false: i = 1. while i < 6:
Similar questions