What are loop control elements for a while loop in python?
Answer:
The elements of a loop that control and govern its execution are called loop control elements. These are four in number namely:
- Initialization expression - It gives an initial value to the loop variable. This is done outside the loop.
- Test expression - decides whether the loop is to be executed or not.
- Body of the loop - consists of the statements that are executed iteratively till the test expression remains true.
- Update expression - is a statement that changes the value of the loop variable. This is given within the body of the loop.