Adopted new convention from template
This commit is contained in:
parent
1427c84dd9
commit
3c0993b179
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python
|
||||||
"""
|
"""
|
||||||
Created on 04 Mar 2021
|
Created on 04 Mar 2021
|
||||||
|
|
||||||
@ -13,7 +13,6 @@ from utils import timeit
|
|||||||
|
|
||||||
|
|
||||||
@timeit("Problem 33")
|
@timeit("Problem 33")
|
||||||
|
|
||||||
def compute():
|
def compute():
|
||||||
"""
|
"""
|
||||||
The fraction 49/98 is a curious fraction, as an inexperienced mathematician
|
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.
|
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
|
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,
|
If the product of these four fractions is given in its lowest common terms,
|
||||||
find the value of the denominator.
|
find the value of the denominator.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
numerator = 1
|
numerator = 1
|
||||||
denominator = 1
|
denominator = 1
|
||||||
for x in range(10, 100):
|
for x in range(10, 100):
|
||||||
@ -38,10 +39,9 @@ def compute():
|
|||||||
if int(str(x)[0]) / int(str(y)[1]) == x / y:
|
if int(str(x)[0]) / int(str(y)[1]) == x / y:
|
||||||
numerator *= x
|
numerator *= x
|
||||||
denominator *= y
|
denominator *= y
|
||||||
|
|
||||||
return int(denominator/numerator)
|
return int(denominator / numerator)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
print(f"Result for Problem 33 is {compute()}")
|
||||||
print(f"Result for Problem 33: {compute()}")
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user