with open('pe67.txt', 'r') as file: numbers = [[int(num) for num in line.split()] for line in file] numbersRev = reversed(numbers) for line in numbersRev: for item in range(0, len(line)): if item < len(line) - 1: a = line[item] b = line[item + 1] c = max(a, b) numbers[numbers.index(line) - 1][item] += c print(numbers[0][0])
Ludvig Learns Python is about me, Ludvig, who got interested in Python programming after being introduced to Quantopian (algorithm trading) which is built on Python programming. The scope of this blog is to document my learning process and see if it becomes more effective when I need to explain what I'm doing instead of just clicking around.
Showing posts with label problem 67. Show all posts
Showing posts with label problem 67. Show all posts
2017-06-22
Project Euler Problem 67
Since problem 67 was just a "harder" version of problem 18, I figured I'd try my problem 18 solution on it, and voila, it worked!
Labels:
problem 67,
project euler
Subscribe to:
Posts (Atom)