Skip to content

Instantly share code, notes, and snippets.

@droxer
Created June 15, 2013 13:55
Show Gist options
  • Select an option

  • Save droxer/5788223 to your computer and use it in GitHub Desktop.

Select an option

Save droxer/5788223 to your computer and use it in GitHub Desktop.
def rota(people):
_people = list(people)
current = 0
while len(_people):
yield _people[current]
current = (current + 1) % len(_people)
if __name__ == "__main__":
people = ["Ant", "Bernard", "Carly", "Deb", "Englebert"]
r = rota(people)
for i in range(10):
print "It's %s's turn." % r.next()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment