0% found this document useful (0 votes)
6 views

Else-Statement-in-Python

The document explains conditional statements in Python, which allow programs to make decisions based on certain conditions. It details four types of conditional statements: IF, IF-ELSE, IF-ELIF-ELSE, and NESTED statements, along with their syntax and examples. Additionally, it lists conditional operators used for comparisons within these statements.

Uploaded by

jbl.libra009
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Else-Statement-in-Python

The document explains conditional statements in Python, which allow programs to make decisions based on certain conditions. It details four types of conditional statements: IF, IF-ELSE, IF-ELIF-ELSE, and NESTED statements, along with their syntax and examples. Additionally, it lists conditional operators used for comparisons within these statements.

Uploaded by

jbl.libra009
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

ELSE

STATEMENT
IN PYTHON
CONDITIONAL STATEMENTS
A Statement that makes the program smarter, it makes the
program decides on what to do in certain CONDITIONS.
CONDITIONAL STATEMENTS
A Statement that makes the program smarter, it makes the
program decides on what to do in certain CONDITIONS.

4 TYPES OF CONDITIONAL STATEMENTS


IF Statement
IF-ELSE Statement
IF-ELIF-ELSE Statement
NESTED Conditional Statement
CONDITIONAL OPERATORS
Are used to compare values inside a Conditional Statements.

CONDITIONAL OPERATORS
• == - EQUAL
• != - NOT EQUAL
• > - GREATER THAN
• < - LESS THAN
• >= - GREATER THAN or EQUAL
• <= - LESS THAN or EQUAL
IF-ELSE STATEMENT
Used when dealing with TWO CONDITIONS.

SYNTAX EXAMPLE
if valueOne == valueTwo: if age >= 18:
#Do Something print("Legal Age")
else: else:
#Do Something print("Too Young")
IF-ELIF-ELSE STATEMENT
Used when dealing with THREE OR MORE CONDITIONS.

SYNTAX EXAMPLE
if valueOne == valueTwo: if age >= 18:
#Do Something print("Legal Age")
elif valueOne >= valueTwo: elif age >= 13:
#Do Something print("Teenager")
else: else:
#Do Something print("Too Young")
NESTED CONDITIONAL STATEMENT
Used when dealing with CONDITIONS INSIDE A CONDITION.
SYNTAX EXAMPLE
if valueOne == valueTwo: if age >= 18:
if valueThree == valueFour: if height >= 170:
#Do Something print(“Legal Age and Tall”)
elif valueThree == valueFive: elif height >= 156:
#Do Something print(“Legal Age and
else: Average)
#Do Something else:
print(“Legal Age and Short”)

You might also like