whoops forgot to commit

This commit is contained in:
Tanishq Dubey 2023-12-02 21:26:56 -05:00
parent 6b375f6a15
commit 324ad42383

View File

@ -1,4 +1,3 @@
fname = "input"
data = []
@ -39,3 +38,30 @@ for d in data:
total = total + gid
print(total)
total = 0
for d in data:
mins = {
"red": 0,
"blue": 0,
"green": 0,
}
ginfo = d.split(":")
gid = int(ginfo[0].split("Game")[-1])
sets = ginfo[-1].split(";")
for s in sets:
d = s.split(",")
for item in d:
item = item.strip()
vals = item.split(" ")
color = vals[-1]
count = int(vals[0])
if mins[color] < count:
mins[color] = count
stotal = 1
for k, v in mins.items():
stotal = stotal * v
total = total + stotal
print(mins, gid, stotal)
print(total)