-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAOC_day6_part2.py
36 lines (34 loc) · 955 Bytes
/
AOC_day6_part2.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
import re
import pandas as pd
import openpyxl
import numpy as np
File = open("Day6_Input.txt", "r")
Lines = File.readlines()
Points = 0
condition = False
Group = []
GroupLines = []
LineCounter = 0
for Line in Lines:
# print(Line)
if condition == False:
for ele in Line.strip():
Group.append(ele)
GroupLines.append(LineCounter)
LineCounter += 1
if Line.strip() == "" or LineCounter == len(Lines):
LettersArray = np.array(Group)
Letters = np.unique(Group)
# print(Letters)
# print(GroupLines)
for Letter in Letters:
AllTrue = True
for LetterLine in GroupLines:
if Letter not in Lines[LetterLine]:
AllTrue = False
if AllTrue == True:
# print(Letter,'points')
Points += 1
Group = []
GroupLines = []
print(Points)