Objective
Create a Python program that goes through a list by hand, the way the for loop does internally.
Instructions
- Read a line with words separated by spaces (at least one).
- Get an iterator with
iter(words)and ask for the elements withnext()inside awhile True. Catch theStopIterationexception withtry/exceptto leave the loop. - Show
Item: Xfor each word and, when finished,End.
sol luna mar
Item: sol
Item: luna
Item: mar
End
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise