Adopted new convention from template

This commit is contained in:
David Doblas Jiménez 2022-09-29 22:22:08 +02:00
parent 5cd3b975ae
commit 1427c84dd9

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
"""
Created on 26 Feb 2021
@ -19,7 +19,7 @@ def compute():
the digits 1 to n exactly once; for example, the 5-digit number, 15234, is
1 through 5 pandigital.
The product 7254 is unusual, as the identity, 39 × 186 = 7254, containing
The product 7254 is unusual, as the identity, 39 x 186 = 7254, containing
multiplicand, multiplier, and product is 1 through 9 pandigital.
Find the sum of all products whose multiplicand/multiplier/product identity
@ -29,10 +29,10 @@ def compute():
"""
ans = set()
pandigital = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
pandigital = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
for x in range(1, 100):
for y in range(100, 10000):
for y in range(100, 10_000):
# product = x * y
if sorted(str(x) + str(y) + str(x * y)) == pandigital:
ans.add(x * y)
@ -41,5 +41,4 @@ def compute():
if __name__ == "__main__":
print(f"Result for Problem 32: {compute()}")
print(f"Result for Problem 32 is {compute()}")