Created
July 12, 2014 12:49
-
-
Save sc0tt/e0592e1e4aba43c98ede to your computer and use it in GitHub Desktop.
Player picker
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 | |
name_list = None | |
with open("names.txt") as name_file: | |
name_list = [n.strip() for n in name_file.readlines()] | |
if len(name_list) % 2: | |
exit("Number of Players is not Even") | |
with open("out_names.txt", "w") as out: | |
while name_list: | |
p1 = name_list.pop(random.randrange(len(name_list))) | |
p2 = name_list.pop(random.randrange(len(name_list))) | |
out.write("%s - %s\n" % (p1, p2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment