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

Control Structures

Uploaded by

baswalganesh1
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)
12 views

Control Structures

Uploaded by

baswalganesh1
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/ 9

Control Structures in Python

Control Structures

The commands learned so far followed a linear sequence, until the last command
Is executed. Control structures allow the commands to be executed under certain
Condition.

• Conditional statement
• Loops
• Functions
Conditional statement
if statement
if else statement
elif statement

A conditional statement in Python is a programming construct


that allows you to make decisions based on certain conditions or
criteria. It helps you control the flow of your program by executing
different blocks of code depending on whether a given condition
is true or false.
If Statement

Flowchart of if statement
if else statement
Nested if…else statement

If( condition 1){


Command or statement if condition 1 true
}else if(condition 2) {
Command or statement if condition 2 true
}
……
}else{statement when none of above is true}
Loops
Loops are used in programming to repeat a specific block of code.

Types of loop:

● For loop
● While loop
● Repeat loop
For
For loopLoop

Used to iterate over a vector.

You might also like