Back to questions
QuestionMediumPythonInterview · Navio

Iterators, generators and StopIteration in Python

What happens inside the Python for-loop, how does an iterator differ from a generator, and why is StopIteration needed?

Answer as you would in an interview

Answer aloud or write down a few key points. The text field is optional; the review opens after your attempt.

Loading
Iterators, generators and StopIteration in Python — interview question — ML Mentor