What is the use of python "iter()" and "next()" function? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

What is the use of python "iter()" and "next()" function?

8th Aug 2020, 7:51 AM
Shafayet Arish
Shafayet Arish - avatar
2 Respostas
+ 2
AMOGHA. A. K. , I suppose you just took the content of your post from geeksforgeeks. No problem with that. But it's a bit confusing to read, that iter() takes am iterable and "converts" it to an iterator. What happens is, that iter() creates an iterator that can be used to iterate over an iterable. An iterator is basically a value suplier that yields values "one after the other" from its associated iterable object.
8th Aug 2020, 11:56 AM
Lothar
Lothar - avatar
0
What's the difference between an iterable and an iterator?
8th Aug 2020, 7:57 AM
Shafayet Arish
Shafayet Arish - avatar