-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathday6.py
44 lines (27 loc) · 839 Bytes
/
day6.py
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
from collections import Counter
puzzleInput=open(('/home/anjab/PycharmProjects/AdventofCode/venv/passports.txt'), 'r')
file=puzzleInput.read()
answers=file.split('\n\n')
#Part Two
sumAnswers=0
for answer in answers:
ansCount=(answer.count("\n")+1)
answer=answer.replace("\n","")
charCount=Counter(answer)
elements=charCount.values()
for element in elements:
if(element==ansCount and ansCount!=1):
sumAnswers=sumAnswers+1
if (ansCount == 1):
sumAnswers = sumAnswers + 1
if(sumAnswers==3640):
print(sumAnswers)
print(sumAnswers)
#Part One
#sumAnswers=0
#for answer in answers:
# answer=answer.replace("\n","")
# s = set(answer) # Creates a set of Unique Un-Ordered Elements
# l = len(s)
# sumAnswers=sumAnswers+l
#print(sumAnswers)