0% found this document useful (0 votes)
16 views14 pages

Python Control Statements Guide

The document discusses different types of control statements in Python including selection/conditional statements like if, if-else, if-elif-else, and nested if statements. It also covers iterative/looping statements such as while and for loops. Other topics include break, continue, and pass statements, the range() function, and nested loops.
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)
16 views14 pages

Python Control Statements Guide

The document discusses different types of control statements in Python including selection/conditional statements like if, if-else, if-elif-else, and nested if statements. It also covers iterative/looping statements such as while and for loops. Other topics include break, continue, and pass statements, the range() function, and nested loops.
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

• Selection Control Statements

1. If
2. If – else
3. If-elif-else statements
4. Nested if statements
• Iterative Control Statements
1. While loop
2. For loop
• Break, continue and pass statements
Control Statements
 Control statements in python are used to control the
order of execution of the program based on the
values and logic
Selection/ Conditional
Statements
Jumps/skip one part of code in the program.

1. If
2. If – else
3. If-elif-else statements
4. Nested if statements
If Statement
If-else Statement
If-elif-else Statement
Iterative/looping
Statements
used to repeat the execution of a list of statements.

1. While loop
2. For loop

Nested loops
While Statement
For Statement
Range() funtion
 It is a built-in function.
 Used to iterate over a sequence of numbers.
Syn:- range(begin,start,[step])
 [step]can be either positive or negative value
break/continue/pass
Statements
1. Break: (Terminates the loop and transfers execution to
the statement immediately following the loop)
2. Continue: (Stop the current iteration and continues
the with next one)
3. Pass: (specifies ‘null’ operation or No operation)
break Statement
1. It breaks the current loop
2. Break and continue statements outside a loop causes
an error.
Continue Statement
Skip the next statements in the iteration

You might also like