כיצד הייתם ממשים לולאת FOR בעצמכם??
הנה הצעה ליישום:
תקציר
Create an iterator object from that iterable
iter_obj = iter(iterable)
Infinite loop
while True:
try:
# Get the next item
item = next(iter_obj)
# Do something with the element
except StopIteration:
#If StopIteration is raised, break from loop
break