Created
January 30, 2017 06:18
-
-
Save feliperyan/1a050915e4db049a8c4f84b527d1aa53 to your computer and use it in GitHub Desktop.
Round Robin Algo
This file contains 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
from copy import deepcopy | |
def go_round_robin(list_of_lists): | |
robin = deepcopy(list_of_List) | |
i = len(robin) | |
while len(robin) > 0: | |
j = i % len(robin) | |
try: | |
print(robin[j].pop(0)) | |
except IndexError as e: | |
robin.pop(j) | |
i -= 1 | |
i+=1 | |
a = ['a','b', 'c'] | |
b = ['d', 'e'] | |
c = ['f', 'g', 'h', 'j'] | |
original = [a, b, c] | |
go_round_robin(original) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment