Loading...
The Custom Iterator
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- mid, senior
Problem
A data pipeline framework needs a reusable range-like generator that can be embedded in for loops. Implement a Range class that accepts start, stop, and optional step arguments and behaves like Python's built-in range but as a class with proper iterator protocol - __iter__ and __next__.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.