Answer Posted / hr@tgksolutions.com
An object that lets you go through a collection's items (such lists, tuples, or dictionaries) one at a time is called an iterator in Python. An iterator implements two methods: __next__(), which returns the subsequent item in the sequence and raises StopIteration when the sequence is exhausted, and __iter__(), which returns the iterator object itself.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Why is python good for machine learning?
Which database is used in python?
Explain try, raise, and finally?
How web scraping is done in python, explain in short?
Tell me why and when do you use generators in python?
How to create dynamic array in python?
How do you use isalpha in python?
Does every class need a constructor?
Where is the math.py (socket.py, regex.py, etc.) Source file?
Do you need python to run a python program?
What is the use of numpy package?
What is the difference between runtime and compile time?
Is there a switch..case statement in python?
How do I emulate os.kill() in windows?
Is python as powerful as c++?