0% found this document useful (0 votes)
3 views10 pages

Loops in Python

loops in python

Uploaded by

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

Loops in Python

loops in python

Uploaded by

sneharose
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Loops in Python

By,
Asst. Prof Mrs. Sneha Rose
IT Vertical
• Loops are important in Python or in any other programming language as they help you to execute a
block of code repeatedly.

• Loops in Python provides three ways for executing the loops.

• While all the ways provide similar basic functionality, their syntax and condition-checking time differ.

• In this class, we will look at Python loops and understand their working with the help of examples.

• Types of Loops

• For Loop

• While Loop
For Loop

• Keyword – for

• For loop is a control flow statement in programming that allows you to execute a
block of code repeatedly based on a specified condition.

• A for loop is used for iterating over a sequence (a list, a tuple, a dictionary, a set, or
a string).

• With the for loop we can execute a set of statements, once for each item in a list,
tuple, set etc.
Syntax in
C
Workflow
The range() Function
• To loop through a set of code a specified number of times, we can use
the range() function.

• The range() function returns a sequence of numbers, starting from 0 by default,


and increments by 1 (by default), and ends at a specified number.
THANK YOU

You might also like