Basic difference between iterable, iterator, iteration in python. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Basic difference between iterable, iterator, iteration in python.

What is the most basic definition of "iterable", "iterator" and "iteration" in Python? I have read multiple definitions but I am unable to identify the exact meaning. Can anyone please explain these terms in very simple way.

8th Aug 2019, 4:46 PM
Kamakshi Trivedi
2 Answers
+ 4
iterable means it can be gone through one item at a time or in steps. iterator is the means of way going through them iteration is the process. This isn't exact but its a super basic idea. Hopefully someone can make it simpler. ~edit: Michael says it even better
8th Aug 2019, 5:03 PM
James
James - avatar
+ 4
iteration is the process of repeating something multiple times (a loop) an iterable is an object you can loop over, because it has multiple elements (a list, a tuple, a dictionary, a string) an iterator is an object (a pointer) that „walks“ through the iterable from element to element until a specific stop-condition occurs.
8th Aug 2019, 5:15 PM
Michael
Michael - avatar