Python Language / Python Conditional StatementsIt is used to execute a certain block / lines of code / alter certain data only if a specific condition has been met in a computer program. There are 4 conditional statements1. If statement. 2. Elif statement. 2. Else statement. 3. Switch-Case statements. Python If statements In if statement if the condition is true it will execute true block otherwise it execute the code below the lines below the true block code.
Explanation: Here a, b are variables. Elif statement In if statement if the condition is true it will execute true block otherwise it execute else block of code.
Else statement Else is used when if , elif are false.
|