0
What is exact diffrence between iterator and generator?
explain one example of iterator and generator? why using iterator and generator? when using?
3 Antworten
+ 1
Iterators is sth you use to iterate aka LOOP through an object(could be a list, string, dict, tuple,etc)
A generator is an instant way to create values WHICH doesn’t take up memory unless you call it as opposed to a list, tuple, dict,..
0
give one example?
- 1
Iterators iterate over something existing.
Generators generate something new.