Created
June 15, 2013 13:55
-
-
Save droxer/5788223 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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