Add code for 2015 advent that I did historically.
This commit is contained in:
parent
13968ed94e
commit
9e9e556c73
25 changed files with 598 additions and 0 deletions
16
day_2/part_2.py
Normal file
16
day_2/part_2.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
ribbon_sum = 0
|
||||
|
||||
|
||||
with open("input", "r") as data:
|
||||
|
||||
|
||||
for line in data:
|
||||
dimensions = line.split("x")
|
||||
l, w, h = [int(x) for x in dimensions]
|
||||
|
||||
min_perimeter = min(l+l+w+w, l+l+h+h, h+h+w+w)
|
||||
volume = l * w * h
|
||||
|
||||
ribbon_sum += min_perimeter + volume
|
||||
|
||||
print(ribbon_sum)
|
||||
Loading…
Add table
Add a link
Reference in a new issue