-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path6.py
More file actions
23 lines (22 loc) · 715 Bytes
/
6.py
File metadata and controls
23 lines (22 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
with open("6.txt") as f:
groups=f.read().split("\n\n")
setList=[]
for g in groups:
setList.append(set("".join(g.split("\n"))))
sum=sum([len(i) for i in setList])
print("Part one : ",sum)
############Start of part Two############
totalsum=0
for g in groups:
members=g.splitlines()
disqualified=set()
for person1 in members:
for person2 in members:
for letter in person1:
if not letter in person2:
disqualified.add(letter)
print(disqualified)
for c in members[0]:
if not c in disqualified:
totalsum+=1
print("Part two : ",totalsum)