0% found this document useful (0 votes)
42 views18 pages

Share 2-Control Statements

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

Share 2-Control Statements

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

• 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
Nested if 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
Ex:- Factorial of number
Nested loop
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
‘else’ statement used
with python
1. Unlike c/c++, in python you can use else statement
with python.

You might also like