mirror of
https://github.com/Hizenberg469/Python-tutorial.git
synced 2026-04-19 23:12:24 +03:00
generator done
This commit is contained in:
10
generators/special_for.py
Normal file
10
generators/special_for.py
Normal file
@@ -0,0 +1,10 @@
|
||||
def special_for(iterable):
|
||||
iterator = iter(iterable)
|
||||
|
||||
while True:
|
||||
try:
|
||||
print(next(iterator))
|
||||
except StopIteration:
|
||||
break
|
||||
|
||||
special_for([1,2,3])
|
||||
Reference in New Issue
Block a user