What are the four elements of a while loop in Python?
Question :
What are the four elements of a while loop in Python?
The four elements of a while loop in Python are:
Initialization Expressions — It initializes the loop control variable and it is given outside the while loop before the beginning of the loop.
Test Expression — If its truth value is true then the loop-body gets executed otherwise not.
The Body of the Loop — It is the set of statements that are executed repeatedly in loop.
Update Expressions — It updates the value of loop control variable and it is given inside the while loop.