Added 2017/02
This commit is contained in:
parent
3115c7c20f
commit
a1d66965f9
12
2017/02/2.md
12
2017/02/2.md
@ -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).
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user