Adopted new convention from template
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python
|
||||||
"""
|
"""
|
||||||
Created on 1 Jan 2018
|
Created on 1 Jan 2018
|
||||||
|
|
||||||
@@ -20,15 +20,15 @@ def compute():
|
|||||||
Work out the first ten digits of the sum of the following one-hundred
|
Work out the first ten digits of the sum of the following one-hundred
|
||||||
50-digit numbers.
|
50-digit numbers.
|
||||||
"""
|
"""
|
||||||
file = Path("../files/Problem13.txt")
|
_file = Path("../files/Problem13.txt")
|
||||||
with open(file, "r") as f:
|
with open(_file, "r") as f:
|
||||||
num = f.readlines()
|
num = f.readlines()
|
||||||
result = 0
|
ans = 0
|
||||||
for line in num:
|
for line in num:
|
||||||
result += int(line)
|
ans += int(line)
|
||||||
return str(result)[:10]
|
|
||||||
|
return str(ans)[:10]
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
print(f"Result for Problem 13 is {compute()}")
|
||||||
print(f"Result for Problem 13: {compute()}")
|
|
||||||
|
|||||||
Reference in New Issue
Block a user