What is ‘for loop’?

For loop acts as an iterator in python which is an object that enables a programmer to traverse a container.

In short, for loop help us in doing the same type of task for a particular number of times.

Syntax of ‘for loop’

Examples using ‘for loop’

show answer

The following example uses list.

show answer

show answer

show answer

show answer

show answer

The following example uses list as well as tuple.

show answer

Comment you doubts in the comment section.

Leave a Reply

Close Menu