LearnPy Hub
← Iterators & Generators problems
Easy

Next With a Default

Make an iterator over the input words with iter(). Call next(it, 'done') k times and print each result on its own line.

Input

Words; then k.

Output

k lines.

Sample 1

Input
a b
3
Output
a
b
done

Sample 2

Input
x y z
2
Output
x
y
solution.py
Output appears here
Next With a Default · Python practice problem · LearnPy Hub