diff --git a/src/Python/Problem013.py b/src/Python/Problem013.py new file mode 100644 index 0000000..0215f4b --- /dev/null +++ b/src/Python/Problem013.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +""" +Created on 1 Jan 2018 + +@author: David Doblas Jiménez +@email: daviddoji@pm.me + +Solution for problem 13 of Project Euler +https://projecteuler.net/problem=13 +""" + +from utils import timeit + + +@timeit("Problem 13") +def compute(): + """ + Work out the first ten digits of the sum of the following one-hundred + 50-digit numbers. + """ + + with open("files/Problem13.txt", "r") as f: + num = f.readlines() + result = 0 + for line in num: + result += int(line) + return str(result)[:10] + + +if __name__ == "__main__": + + print(f"Result for Problem 13: {compute()}") \ No newline at end of file