first fix
This commit is contained in:
21
02/02.py
21
02/02.py
@@ -12,20 +12,23 @@ sol = 0
|
||||
for line in lines:
|
||||
line = line.replace('\n', "")
|
||||
gameid = line.split(":")[0].split(" ")[1]
|
||||
game = line.split(":")[1].split(",")
|
||||
game = line.split(":")[1].split(";")
|
||||
valid = True
|
||||
for color in game:
|
||||
for pull in game:
|
||||
colors = pull.split(',')
|
||||
for color in colors:
|
||||
temp = color.split(' ')
|
||||
if 'red' in temp[1]:
|
||||
if int(temp[0]) > maxred:
|
||||
if 'red' in temp[2]:
|
||||
if int(temp[1]) > maxred:
|
||||
valid = False
|
||||
elif 'green' in temp[1]:
|
||||
if int(temp[0]) > maxgreen:
|
||||
elif 'green' in temp[2]:
|
||||
if int(temp[1]) > maxgreen:
|
||||
valid = False
|
||||
elif 'blue' in temp[1]:
|
||||
if int(temp[0]) > maxblue:
|
||||
elif 'blue' in temp[2]:
|
||||
if int(temp[1]) > maxblue:
|
||||
valid = False
|
||||
if not valid:
|
||||
sol += gameid
|
||||
print(gameid)
|
||||
sol += int(gameid)
|
||||
|
||||
print(sol)
|
||||
|
Reference in New Issue
Block a user