FOR Loop

For Loop is used to iterate a task number of times. The loop allows traversal over an iterable objects like lists, tuple and strings.


>>> for val in sequence :

. . .      body of for

>>> else:

. . .      body of else part


here val is a variable that takes values from the sequence. On each iteration val takes one value from the sequence of iterable object till all items are exhausted.

Flowchart of a Loop Process in Python



Updated: April 19, 2019 — 11:01 am

Leave a Reply

Your email address will not be published. Required fields are marked *

care4you © 2020 Connect On Facebook Protection Status