From 3c0993b1798991a8ff968910ef7566fbe7af23a9 Mon Sep 17 00:00:00 2001 From: daviddoji Date: Thu, 29 Sep 2022 22:22:19 +0200 Subject: [PATCH] Adopted new convention from template --- src/Python/Problems001-050/Problem033.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Python/Problems001-050/Problem033.py b/src/Python/Problems001-050/Problem033.py index 70a687a..9efb4a5 100644 --- a/src/Python/Problems001-050/Problem033.py +++ b/src/Python/Problems001-050/Problem033.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python """ Created on 04 Mar 2021 @@ -13,7 +13,6 @@ from utils import timeit @timeit("Problem 33") - def compute(): """ The fraction 49/98 is a curious fraction, as an inexperienced mathematician @@ -23,11 +22,13 @@ def compute(): We shall consider fractions like, 30/50 = 3/5, to be trivial examples. There are exactly four non-trivial examples of this type of fraction, less - than one in value, and containing two digits in the numerator and denominator. + than one in value, and containing two digits in the numerator and + denominator. If the product of these four fractions is given in its lowest common terms, find the value of the denominator. """ + numerator = 1 denominator = 1 for x in range(10, 100): @@ -38,10 +39,9 @@ def compute(): if int(str(x)[0]) / int(str(y)[1]) == x / y: numerator *= x denominator *= y - - return int(denominator/numerator) + + return int(denominator / numerator) if __name__ == "__main__": - - print(f"Result for Problem 33: {compute()}") \ No newline at end of file + print(f"Result for Problem 33 is {compute()}")