In this module we will be discussing one of the most important building blocks of Python Programming Language.
The ability to change the behavior of a piece of code which is based on certain information in the environment is known as conditional code flow. The conditional logic in Python is primarily based on the “if … else” structure.
Here, we will be discussing:
Learn Python in 16 hrs from experts
If-statement is used to test a condition, if-condition is true then the code inside the if statement is executed otherwise that code is not executed.
If else is also used to test a condition, if condition is true then the code inside the if statement is executed otherwise else part is executed.
It contains multiple if else condition. It is used to check the multiple conditions. This statement is like executing a if statement inside an else statement.
It is a jump statement which is used to transfer the control to the end of loop.
It is also a jump statement which is used to skip the current statement and forces to execute next iteration.
In this body is executed until the condition is true. Once the condition becomes false then control comes out the loop.
For loop executes the sequence of code according to the specified times and conditions.
Loop defined within another loop is known as nested loops.
This brings us to the end of the python loops. In the next module, we will be discussing the functions and see how they work.Previous Next
Learn SQL in 16 hrs from experts