diff --git a/src/Python/Problems001-050/Problem042.py b/src/Python/Problems001-050/Problem042.py index 4019767..35b3842 100644 --- a/src/Python/Problems001-050/Problem042.py +++ b/src/Python/Problems001-050/Problem042.py @@ -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: