Python flow control is regulated by conditional statements, loops and function calls.

Image for post

Control flow statements

Python if….else statement:

· To create decisions in a coding we use different forms of if…else statements.

· Used for making decisions while we execute a code based on conditions.

· Checking for conditions:

1. Satisfied: execute the statement

2. Not satisfied: execute the else statement

Image for post

Re-running the program.

Image for post

Remember, if…else statement evaluates <> and will execute the body only if the condition is True; else statement will be executed if the condition is False.

#python-programming #data-science #python

Python Control Flow Statements
1.45 GEEK