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

Ifelse_Notes

Chapter 5 discusses conditional statements in Python, focusing on If-Else statements which allow for different code execution based on evaluated conditions. The document explains the syntax and functionality of the If statement, which executes a block of code if a condition is true, and the If-Else statement, which provides an alternative block of code for when the condition is false. Flowcharts are mentioned as a visual aid for understanding the decision-making process in programming.

Uploaded by

vidhu.bhis
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 views2 pages

Ifelse_Notes

Chapter 5 discusses conditional statements in Python, focusing on If-Else statements which allow for different code execution based on evaluated conditions. The document explains the syntax and functionality of the If statement, which executes a block of code if a condition is true, and the If-Else statement, which provides an alternative block of code for when the condition is false. Flowcharts are mentioned as a visual aid for understanding the decision-making process in programming.

Uploaded by

vidhu.bhis
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
You are on page 1/ 2

CHAPTER-5 Python

Conditional statements in Python play a key role in determining the direction of program execution.
Among these, If-Else statements are fundamental, providing a way to execute different blocks of code
based on specific conditions. As the name suggests, If-Else statements offer two paths, allowing for
different outcomes depending on the condition evaluated.

Python If Statement

The if statement is the most simple decision-making statement. It is used to decide whether a certain
statement or block of statements will be executed or not.

Flowchart of If Statement:

Syntax of If Statement in Python:

Here, the condition after evaluation will be either true or false. if the statement accepts boolean values
– if the value is true then it will execute the block of statements below it otherwise not.

if condition:
# Statements to execute if
# condition is true

Python If Else Statement

The if statement alone tells us that if a condition is true it will execute a block of statements and if the
condition is false it won’t. But if we want to do something else if the condition is false, we can use the
else statement with the if statement Python to execute a block of code when the Python if condition is
false.
Syntax of If Else in Python:

if (condition):
# Executes this block if
# condition is true
else:
# Executes this block if
# condition is false

You might also like