Fix project, now use python 3.

This commit is contained in:
Bert Peters
2015-12-14 00:29:02 +01:00
parent cf7d12fbf0
commit 0b94c1e7dc
14 changed files with 35 additions and 34 deletions

View File

@@ -7,10 +7,10 @@ def totals(obj):
return obj
if isinstance(obj, list):
return sum(totals(i) for i in obj)
if not isinstance(obj, dict) or "red" in obj.values():
if not isinstance(obj, dict) or "red" in list(obj.values()):
return 0
return sum(totals(i) for i in obj.values())
return sum(totals(i) for i in list(obj.values()))
fileData = ''.join(line for line in fileinput.input())
@@ -20,4 +20,4 @@ total = sum(int(match) for match in pattern.findall(fileData))
data = json.loads(fileData)
print total, totals(data)
print(total, totals(data))