LearnPy Hub
← Iterators & Generators problems
Easy

When the Iterator Runs Out

Read words. Make an iterator and call next() in a loop until StopIteration is raised, printing each word. Then print finished.

Input

Words separated by spaces.

Output

Several lines.

Sample 1

Input
a b c
Output
a
b
c
finished

Sample 2

Input
hello
Output
hello
finished
solution.py
Output appears here
When the Iterator Runs Out · Python practice problem · LearnPy Hub