From 5f36185d59a19fffeb261b9fa6ef298588845c61 Mon Sep 17 00:00:00 2001 From: daviddoji Date: Mon, 3 Oct 2022 15:59:00 +0200 Subject: [PATCH] Adopted new convention from template --- src/Python/Problem057.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Python/Problem057.py b/src/Python/Problem057.py index bc703f5..6bbb07c 100644 --- a/src/Python/Problem057.py +++ b/src/Python/Problem057.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python """ Created on 09 Oct 2021 @@ -10,6 +10,7 @@ https://projecteuler.net/problem=57 """ from fractions import Fraction + from utils import timeit @@ -21,7 +22,7 @@ def compute(): By expanding this for the first four iterations, we get: - 1 + 1/2 = 3/2 = 1.5 + 1 + 1/2 = 3/2 = 1.5 1 + 1/2+1/2 = 7/5 = 1.4 1 + 1/2+1/2+1/2 = 17/12 = 1.41666... 1 + 1/2+1/2+1/2+1/2 = 41/29 = 1.41379... @@ -36,7 +37,7 @@ def compute(): ans = 0 f = Fraction(1, 2) - for i in range(1000): + for _ in range(1000): f = 1 / (2 + f) result = 1 + f if len(str(result.numerator)) > len(str(result.denominator)): @@ -46,5 +47,4 @@ def compute(): if __name__ == "__main__": - - print(f"Result for Problem 57: {compute()}") + print(f"Result for Problem 57 is {compute()}")