This commit is contained in:
David Doblas Jiménez 2021-10-06 17:48:19 +02:00
parent 720668c101
commit d7d41fc4fb

View File

@ -9,6 +9,7 @@ Solution for problem 42 of Project Euler
https://projecteuler.net/problem=42
"""
from pathlib import Path
from utils import timeit
@ -37,7 +38,9 @@ def compute():
triangular_numbers = [triangle_number(n) for n in range(27)]
ans = 0
with open("files/Problem42.txt", "r") as f:
file = Path("/datos/Scripts/Gitea/Project_Euler/src/files/Problem42.txt")
with open(file, "r") as f:
words = f.readline().strip('"').split('","')
for word in words:
if word_to_value(word) in triangular_numbers: