Skip to content

Instantly share code, notes, and snippets.

@sajnikanth
Created July 30, 2018 08:36
Show Gist options
  • Save sajnikanth/2e6b8c9aeb4ea538a5caf4eb22914bf8 to your computer and use it in GitHub Desktop.
Save sajnikanth/2e6b8c9aeb4ea538a5caf4eb22914bf8 to your computer and use it in GitHub Desktop.
Pair Programming Randomiser
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