Skip to content

Commit f9b3885

Browse files
committed
implemented day 06 in python
1 parent 4a21925 commit f9b3885

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
with open("PATH") as f:
2+
string = ""
3+
all = 0
4+
total = 0
5+
totalAll = 0
6+
for line in f.read().split("\n"):
7+
if line != "":
8+
string += line
9+
all += 1
10+
else:
11+
letters = [0] * 26
12+
for char in string:
13+
letters[ord(char) - ord("a")] += 1
14+
for letter in letters:
15+
total += (letter > 0)
16+
totalAll += (all == letter)
17+
string = ""
18+
all = 0
19+
20+
# part 1
21+
print(total)
22+
# part 2
23+
print(totalAll)

0 commit comments

Comments
 (0)