Untitled diff

Created Diff never expires
5 removals
Words removed24
Total words75
Words removed (%)32.00
20 lines
5 additions
Words added14
Total words65
Words added (%)21.54
20 lines
def check(types, value):
def check(types, value):
value = int(value)
value = int(value)
if types == "cats:" or types == "trees:":
if types in ("cats:", "trees:"):
return props[types] < value
return props[types] < value
elif types == "pomeranians:" or types == "goldfish:":
elif types in ("pomeranians:", "goldfish:"):
return props[types] > value
return props[types] > value
return props[types] == value
return props[types] == value


props = {}
props = {}
with open("inpt.txt") as g:
with open("inpt.txt") as g:
for line in g:
for line in g:
line = line.strip("\n").split(" ")
line = line.strip().split()
props[line[0]] = int(line[1])
props[line[0]] = int(line[1])




with open("input16.txt") as f:
with open("input16.txt") as f:
for line in f:
for line in f:
line = line.strip("\n").split(" ")
line = line.strip().split()
if (check(line[2], line[3].strip(",")) and check(line[4], line[5].strip(",")) and check(line[6], line[7])):
if all(check(line[i], line[i+1].strip(",")) for i in range(2,7,2)):
print line
print line