Untitled diff

Created Diff never expires
5 刪除
總計
刪除
單詞
總計
刪除
要繼續使用此功能,請升級到
Diffchecker logo
Diffchecker Pro
20
5 新增
總計
新增
單詞
總計
新增
要繼續使用此功能,請升級到
Diffchecker logo
Diffchecker Pro
20
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