Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
7 views

Iterative Statements in Python

The document discusses iterative statements in Python, which allow for the repetition of code based on a condition. It highlights the benefits of using loops for reducing instructions and memory usage. Two main types of loops are covered: the 'for' loop, used for a known number of iterations, and the 'while' loop, used when the number of iterations is unknown.

Uploaded by

sathyaa.m1720
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Iterative Statements in Python

The document discusses iterative statements in Python, which allow for the repetition of code based on a condition. It highlights the benefits of using loops for reducing instructions and memory usage. Two main types of loops are covered: the 'for' loop, used for a known number of iterations, and the 'while' loop, used when the number of iterations is unknown.

Uploaded by

sathyaa.m1720
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

ITERATIVE

STATEMENTS
IN PYTHON
Chap 4
Concept of Loop

• In a program, there are situations when we


have to repeat one or more statements
multiple times. This repetition can be carried
out using Loops in programming.
• The advantage of using the looping technique
in programming is that it reduces the number
of instructions and the usage of memory
space.
KRISH_INFO_TECH
Iterative Statements

The statements that keep repeating themselves as long as given condition is


True are called Iterative Statements or Repetitive Statements.

As soon as the condition becomes False, the loop terminates.

These statements are also called as Looping Statements or simply Loops.


KRISH_INFO_TECH
An iterative statement is based on three values:
A start value (initial A step value (increment
A test condition
value) or decrement)

Every loop works with the help of a variable known as


the Control variable.
KRISH_INFO_TECH
Types of Iterative Statements

KRISH_INFO_TECH
for Loop
• The for loop is used when we are sure about the number of
times a loop body will be executed.
• It is also known as a definite loop.
• The for loop in Python is used to iterate over the items of a
sequence in order, such as a list or a tuple for a fixed number
of times.

KRISH_INFO_TECH
While Loop
• The while loop is the simplest of all looping structures.
• This loop can be applied to a program where the number of
iteration is not known beforehand.
• The while loop keeps on executing the block of a statement
as long as the specified test condition evaluates to true.

KRISH_INFO_TECH

You might also like