Created
July 30, 2018 08:36
-
-
Save sajnikanth/2e6b8c9aeb4ea538a5caf4eb22914bf8 to your computer and use it in GitHub Desktop.
Pair Programming Randomiser
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
import random | |
import json | |
# hard-coded for now; feel free to update this | |
navigators = ['Denys', 'Bo', 'Daniel', 'Saj'] | |
drivers = ['Rabea', 'Mascha', 'Rudy', 'Selam'] | |
groups = {} | |
def random_person(_list): | |
random_index = random.randrange(0, len(_list)) | |
return _list.pop(random_index) | |
while len(navigators) > 0: | |
if len(navigators) == 1: | |
for index, driver in enumerate(drivers): | |
if index == 0: | |
groups[random_person(navigators)] = [driver] | |
else: | |
random_navigator_index = random.randrange(0, len(groups.keys())) | |
groups[groups.keys()[random_navigator_index]].append(driver) | |
else: | |
groups[random_person(navigators)] = [random_person(drivers)] | |
print "\n" + json.dumps(groups) + "\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment