diff --git a/.idea/misc.xml b/.idea/misc.xml
index c4ce182..9313b0a 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,7 +3,7 @@
-
+
\ No newline at end of file
diff --git a/15/15-2.py b/15/15-2.py
index 4e0b0c0..11c750e 100644
--- a/15/15-2.py
+++ b/15/15-2.py
@@ -3,7 +3,7 @@
data = []
# parse input
-input_file = open("input-ex1", "r")
+input_file = open("input", "r")
pattern = []
for line in input_file:
for value in line.rstrip().split(","):
@@ -12,12 +12,12 @@ input_file.close()
def get_hash(val):
- h = 0
+ hav = 0
for b in val:
- h += ord(b)
- h *= 17
- h %= 256
- return h
+ hav += ord(b)
+ hav *= 17
+ hav %= 256
+ return hav
hashsum = 0
@@ -56,8 +56,10 @@ for value in data:
boxes[h] = [value]
print(boxes)
-solution=0
+solution = 0
for key in boxes.keys():
for k in range(len(boxes[key])):
- pass
+ print(key+1, k+1, int(boxes[key][k].split("=")[1]))
+ solution += ((key+1) * (k+1) * int(boxes[key][k].split("=")[1]))
+print("Solution", solution)