fork download
  1. cost = []
  2. for string in open('triangle.txt', 'r').readlines():
  3. line = list(map(int, string.split()))
  4. a = [max(x, y) for (x, y) in zip([0] + cost, cost + [0])]
  5. cost = [x + y for (x, y) in zip(line, a)]
  6.  
  7. print(max(cost))# your code goes here
Runtime error #stdin #stdout #stderr 0.02s 28384KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 2, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'triangle.txt'