0% found this document useful (0 votes)
2 views3 pages

11.python Conditional Statements

The document provides an overview of Python conditional statements, including if, if-else, if-elif-else, nested if, and one-liner statements. It explains how these statements allow for different actions based on conditions and discusses the use of logical operators and the pass statement. Each type of conditional statement is briefly described with its purpose and functionality.

Uploaded by

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

11.python Conditional Statements

The document provides an overview of Python conditional statements, including if, if-else, if-elif-else, nested if, and one-liner statements. It explains how these statements allow for different actions based on conditions and discusses the use of logical operators and the pass statement. Each type of conditional statement is briefly described with its purpose and functionality.

Uploaded by

KARTHIKEYAN S
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

[Link].

com

Python Conditional Statements

1. Introduction

• Conditional statements are used to perform different actions based on


different conditions.
• Python supports the following conditional statements:
• if
• if-else
• if-elif-else
• Nested if
• One-liner if statements

2. if Statement

• Executes a block of code if the condition is True.

3. if-else Statement

• Executes one block of code if the condition is True, another block if False.

1
[Link]

4. if-elif-else Statement

• Checks multiple conditions.

5. Nested if Statement

• if statement inside another if statement.

6. One-liner if and if-else


• Used when there is only one statement to execute.

2
[Link]

7. Using Logical Operators in Conditions

• Combine conditions using and, or, and not.

8. pass Statement in Conditional Blocks

• pass is used as a placeholder when no code needs to be executed.

You might also like