Last active
August 29, 2015 14:23
-
-
Save hatak/11152c53c47b3116c55b to your computer and use it in GitHub Desktop.
Generate presentation order
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
import random | |
import csv | |
group_list = [] | |
members = {} | |
def main(args): | |
with open(sys.argv[1]) as csv_file: | |
reader = csv.reader(csv_file, quotechar='"') | |
for row in reader: | |
if not row[1] in members: | |
members[row[1]] = [] | |
members[row[1]].append(row[0]) | |
group_order = random_sorted(members.keys()) | |
for group in group_order: | |
presenter = random_sorted(members[group])[0] | |
print('%s : %s' % (group, presenter)) | |
def random_sorted(original_list): | |
return sorted(original_list, key=lambda *args: random.random()) | |
if __name__ == '__main__': | |
if len(sys.argv) == 2: | |
main(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment