Loading...
The Counting Machine
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
Implement a Python class called CountUp that takes a list of integers on initialization. When iterated, it yields each element multiplied by its 1-based position index. Implement __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.