Python control structure

Python while loop

Python while loop

Python while loop is of indefinite iteration type, which means the number of times a loop is going to execute is not defined well in advance. The while loop keeps on executing until the condition stays True. Unlike python for loop, while loop does not have incremental/decremental iterator. If the iteration is known in advance then choose for loop otherwise choose while loop.

Python for loop

Python for loop

Python For loop runs over a fixed sequence and various operations are performed under that particular range. Python’s for loop is part of a definite iteration group. In this comprehensive tutorial, you will understand every component to build a for loop and how quickly and efficiently implement them in Python. A developer or a programmer can choose to go with a for loop

Python if else

python if else

Python if-else statement is a part of control structures (sometimes also known as Python flow control). Python if statement helps in making decisions in the program. This is probably the simplest yet most frequently used in Python for decision making. Python’s if-else statement works by evaluating a condition and subsequently making the decision. If a condition is met then execute a certain portion of the code

Scroll to Top