-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplicant_assignment
More file actions
58 lines (46 loc) · 1.64 KB
/
Copy pathapplicant_assignment
File metadata and controls
58 lines (46 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#language = python
#last updated: 1.20.2020
#created by Sarah Ngo, questions? reach out to Sarah.Ngo@ucsf.edu
#use this python script to generate random assignments of applicants to reviewer
#modules needed: pretty table, to install, use: pip install https://pypi.python.org/packages/source/P/PrettyTable/prettytable-0.7.2.tar.bz2
#libraries needed: random
from random import choice
#import list of applicants from .txt files
applicants = []
file = open("applicants.txt", "r")
applicants = file.read().splitlines()
print("The list of applicants are:", applicants)
#start list of reviewers
reviewerA = []
reviewerB = []
reviewerC = []
reviewerD = []
reviewerE = []
Assignments = []
#each reviewer will be assigned 3 applicants. After assignment the randomly selected
#applicant name will be removed from the larger applicant pool to avoid duplication
while len(reviewerE) < 3:
applicantA = choice(applicants)
reviewerA.append(applicantA)x
applicants.remove(applicantA)
applicantB = choice(applicants)
reviewerB.append(applicantB)
applicants.remove(applicantB)
applicantC = choice(applicants)
reviewerC.append(applicantC)
applicants.remove(applicantC)
applicantD = choice(applicants)
reviewerD.append(applicantD)
applicants.remove(applicantD)
applicantE = choice(applicants)
reviewerE.append(applicantE)
applicants.remove(applicantE)
from prettytable import PrettyTable
x = PrettyTable()
x.field_names = ["Reviewer", "Assigned Applicants"]
x.add_row(["ReviewerA", reviewerA])
x.add_row(["ReviewerB", reviewerB])
x.add_row(["ReviewerC", reviewerC])
x.add_row(["ReviewerD", reviewerD])
x.add_row(["ReviewerE", reviewerE])
print(x)