What is the difference between iterable and iterator?

what is the difference between iterable and iterator?
For list x=[1,2,3,4] it is iterable, what is the iterator here?

Hey @nikhil_0406, Iterable is an object, which one can iterate over. It generates an Iterator when passed to iter() method. Iterator is an object, which is used to iterate over an iterable object using next() method. Iterators have __next__() method, which returns the next item of the object. If u want to see some examples with detail, please go through the following links :

  1. difference between iterators & iterables

I hope this helps ! :smile:
Happy Learning ! :+1:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.