Add 2022 extras and rm input/samples
This commit is contained in:
parent
7809a82ce7
commit
1d2098a708
30 changed files with 402 additions and 6471 deletions
23
Python/2022/15/main.py
Normal file
23
Python/2022/15/main.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
input = open("input", 'r')
|
||||
# input = open("sample", 'r')
|
||||
|
||||
data = {}
|
||||
total = 0
|
||||
validLocations = []
|
||||
|
||||
for line in input:
|
||||
line = line.strip()
|
||||
valve, to = line.split("; ")
|
||||
|
||||
name, rate = valve.split(" has")
|
||||
name = name[-2:]
|
||||
rate = int(rate.split("=")[1])
|
||||
|
||||
tonames = to.split("valve")[1].split(", ")
|
||||
tonames[0] = tonames[0][-2:]
|
||||
|
||||
if rate > 0:
|
||||
validLocations.append(name)
|
||||
data[name] = [rate, tonames, False]
|
||||
|
||||
# Part 1
|
||||
Loading…
Add table
Add a link
Reference in a new issue