python tutorial - Python While Loop | While Loop in Python - learn python - python programming
Learn Python - Python tutorial - python while loop - Python examples - Python programs
- A while loop is a control flow statement that allows code to be executed repeatedly based on a given Boolean condition.
- Here, body will execute multiple times till the expression passed is true. The Body may be a single statement or multiple statement.
- Initially, the value in the variable is initialized.
- Secondly, the condition/expression in the while is evaluated. Consequently if condition is true, the control enters in the body and executes all the statements.
- If the condition/expression passed results in false then the control exists the body and straight away control goes to next instruction after body of while.
- Thirdly, in case condition was true having completed all the statements, the variable is incremented or decremented. Having changed the value of variable step second is followed. This process continues till the expression/condition becomes false.
- Finally Rest of code after body is executed.
Program to add digits of a number:
Wikitechy tutorial site provides you all the learn python , learn python for dummies , python coding classes , python online training course , online python course , python training courses , python programming classes , python classes online , python programming for dummies , online python class