fbpx

Statements

Instructions written in the source code for execution are called statements. There are different types of statements in the Python programming language like Assignment statement, Conditional statement, Looping statements etc. These all help the user to get the required output. For example, n = 50 is an assignment statement.

Sequential Statements:

  • Sequential statements are set of statements where the execution process will happen in sequence manner. So, these kind of statements are called as sequential statements.
  • The problem in sequential statements is, if the logic has broken in any one of the line, then complete source code execution will get broken. So, we are going to decision making, iterative and jump statements to avoid this kind of problems.

Decision Making Statements:

  • Decision Making Statements allow the program to take the decision as which statement should be executed next.
  • Decision Making statements are used when we want a set of instructions should be executed in one situation and different instructions should be executed in another situation .
  • Decision making can be implemented in python using,
  1.           if statements
  2.           if-else statements
  3.           if-elif-else statements
  4.           nested if statements

Iteration Statements

Iteration statements or loop statements allow us to execute a block of statements as long as the condition is true.

Loops statements are used when we need to run same code again and again, each time with a different value.

In Python Iteration (Loops) statements are of three type :-

  1.  While Loop
  2.  For Loop
  3.  Nested For Loops