-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmobs.py
More file actions
37 lines (31 loc) · 1.06 KB
/
mobs.py
File metadata and controls
37 lines (31 loc) · 1.06 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
from itertools import combinations
teams = {"team_diamond": ('Josh', 'Lizzie', 'DJ'),
"team_3": ('Nick', 'Leslie', 'Hayato', 'Jim'),
"team_indecisive": ('Nick', 'DJ', 'Leslie'),
"team_pumpkin_spice": ('Jim', 'Hayato', 'Josh', 'Lizzie'),
"team_tic_tap_nope": ('Nick', 'Josh', 'Hayato', 'Lizzie'),
"team_phillies": ('Jim', 'Leslie', 'DJ'),
"team_world_cup_spoilers": ('Leslie', 'Lizzie', 'Josh'),
"team_our_code_socks": ('Jim', 'Nick', 'Hayato'),
"room 1": ('Jim', 'Lizzie', 'Nick'),
"room 2": ('Josh', 'Hayato', 'Leslie', 'Rachel')
}
students = [
"Jim",
"Lizzie",
"Hayato",
"Nick",
"Josh",
"Leslie",
"Rachel"
]
pairings = combinations(students, 2)
pairing_counts = dict.fromkeys(pairings, 0)
for pair in pairing_counts:
for team in teams:
if pair[0] in teams[team] and pair[1] in teams[team]:
pairing_counts[pair] += 1
sorted_pairs = list(pairing_counts.items())
sorted_pairs.sort(key=lambda k: k[1])
for pair in sorted_pairs:
print(pair)