Added 2017/02

This commit is contained in:
FrederikBaerentsen 2024-11-12 19:46:18 +01:00
parent 3115c7c20f
commit a1d66965f9
2 changed files with 22 additions and 5 deletions

View File

@ -29,8 +29,6 @@ In this example, the spreadsheet\'s checksum would be `8 + 4 + 6 = 18`.
Your puzzle answer was `34925`.
The first half of this puzzle is complete! It provides one gold star: \*
## \-\-- Part Two \-\-- {#part2}
\"Great work; looks like we\'re on the right track after all. Here\'s a
@ -64,7 +62,13 @@ In this example, the sum of the results would be `4 + 3 + 2 = 9`.
What is the *sum of each row\'s result* in your puzzle input?
Answer:
Your puzzle answer was `221`.
Although it hasn\'t changed, you can still [get your puzzle
Both parts of this puzzle are complete! They provide two gold stars:
\*\*
At this point, you should [return to your Advent calendar](/2017) and
try another puzzle.
If you still want to see it, you can [get your puzzle
input](2/input).

View File

@ -2,7 +2,9 @@
import sys
from pprint import pprint
input_f = "input" #sys.argv[1]
#input_f = "input" #sys.argv[1]
input_f = sys.argv[1]
sum = 0
with open(input_f) as file:
for line in file:
@ -25,4 +27,15 @@ print(sum)
#########################################
sum = 0
with open(input_f) as file:
for line in file:
line = list(map(int,line.rstrip('\n').split()))
print(line)
for idx,i in enumerate(line):
length=len(line)
for j in range(0,length):
if i % line[j] == 0 and idx != j:
sum+=int(i/line[j])
print(sum)