Rename Project Euler directories and other dependent changes (#3300)

* Rename all Project Euler directories:

Reason:
The change was done to maintain consistency throughout the directory
and to keep all directories in sorted order.

Due to the above change, some config files had to be modified:
'problem_22` -> `problem_022`

* Update scripts to pad zeroes in PE directories
This commit is contained in:
Dhruv
2020-10-15 12:43:28 +05:30
committed by GitHub
parent 2d7e08ef83
commit 44254cf112
177 changed files with 108 additions and 112 deletions

View File

@ -0,0 +1,25 @@
"""
Problem 13: https://projecteuler.net/problem=13
Problem Statement:
Work out the first ten digits of the sum of the following one-hundred 50-digit
numbers.
"""
import os
def solution():
"""
Returns the first ten digits of the sum of the array elements
from the file num.txt
>>> solution()
'5537376230'
"""
file_path = os.path.join(os.path.dirname(__file__), "num.txt")
with open(file_path, "r") as file_hand:
return str(sum([int(line) for line in file_hand]))[:10]
if __name__ == "__main__":
print(solution())