Python Control Statements

The two most commonly used statements in any programming language are as follows :

Sequential statements: These are the statements which are executed one by one.

Control statements: These are the statements that are executed randomly and repeatedly.

Program 1: A Python program to calculate the area of a circle.

Here the instructions are executed one by one by the Python interpreter This is called sequential execution. This type of execution is suitable only for developing simple programs. It is not suitable for developing critical programs where complex logic is needed.

Control Statements

  • if statement
  • if ... else statement
  • if ... elif ... else statement
  • while loop
  • for loop
  • else suite
  • break statement
  • continue statement
  • pass statement
  • assert statement
  • return statement

Please note that the switch statement found in many languages like C and Java is not available in Python.