Guest User

Untitled

a guest
Jan 27th, 2020
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. def loop_without_for(iterable, action_to_do):
  2.     iterator = iter(iterable)
  3.     done_looping = False
  4.     while not done_looping:
  5.         try:
  6.             item = next(iterator)
  7.         except StopIteration:
  8.             done_looping = True
  9.         else:
  10.             action_to_do(item)
Advertisement
Add Comment
Please, Sign In to add comment