If_else Python
If_else Python
Def:
Syntax:
if (condition):
statement
elif() --- else if
Def:
1. The elif (short for "else if") statement is used to check another condition if the
previous if or elif conditions were False.
2. If the condition evaluates to True, the code block associated with it is executed.
3. Its used for multiple conditions.
Syntax:
elif (condition):
statement
else()
Def:
The else keyword catches anything which isn't caught by the preceding
conditions.
Statement become false, else will print.
Example:
a = 200
b = 33
if b > a:
print("b is greater than a")
else:
print("b is not greater than a")