You are here

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.

Syntax:

>>> 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

LOOP

 

Leave a Reply

Top
error: Content is protected !!