Adopted new convention from template

This commit is contained in:
2022-09-22 09:06:22 +02:00
parent fbaeeed8f3
commit 4a89c7613c

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python3 #!/usr/bin/env python
""" """
Created on 7 Jan 2018 Created on 7 Jan 2018
@@ -11,6 +11,7 @@ https://projecteuler.net/problem=14
from utils import timeit from utils import timeit
def chain_length(n, terms): def chain_length(n, terms):
length = 0 length = 0
while n != 1: while n != 1:
@@ -24,6 +25,7 @@ def chain_length(n, terms):
length += 1 length += 1
return length return length
@timeit("Problem 14") @timeit("Problem 14")
def compute(): def compute():
""" """
@@ -46,6 +48,7 @@ def compute():
NOTE: Once the chain starts the terms are allowed to go above one million. NOTE: Once the chain starts the terms are allowed to go above one million.
""" """
ans = 0 ans = 0
limit = 1_000_000 limit = 1_000_000
score = 0 score = 0
@@ -55,9 +58,9 @@ def compute():
if terms[i] > score: if terms[i] > score:
score = terms[i] score = terms[i]
ans = i ans = i
return ans return ans
if __name__ == "__main__": if __name__ == "__main__":
print(f"Result for Problem 14 is {compute()}")
print(f"Result for Problem 14: {compute()}")