0% found this document useful (1 vote)
4 views

If_else Python

Uploaded by

pugazhm125
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
4 views

If_else Python

Uploaded by

pugazhm125
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Python Programming

-Neowep software technologies

Python Decision making statements


 if (condition):
# code block to execute if condition is True
 elif (condition):
# code block to execute if the first condition is False and this condition is True
 else:
# code block to execute if all previous conditions are False
if()

Def:

1. If the statement is True, it will print.

2. If the statement is False, nothing will print.

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")

You might also like