Javatpoint Logo
Javatpoint Logo

Python iter() Function

The python iter() function is used to return an iterator object. It creates an object which can be iterated one element at a time.

Signature

Parameters

object: An iterable object.

sentinel (optional)- It is a special value that represents the end of a sequence.

Return

It returns an iterator object.

Python iter() Function Example 1

The below example shows the working of iter().

Output:

1
2
3
4
5

Explanation: In the above example, iter() function converts an list iterable to an iterator.


Next TopicPython Functions





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA