mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-19 19:03:02 +08:00
psf/black code formatting (#1277)
This commit is contained in:

committed by
Christian Clauss

parent
07f04a2e55
commit
9eac17a408
@ -28,13 +28,11 @@ def isCombinationValid(combination):
|
||||
|
||||
"""
|
||||
return (
|
||||
int(''.join(combination[0:2])) *
|
||||
int(''.join(combination[2:5])) ==
|
||||
int(''.join(combination[5:9]))
|
||||
int("".join(combination[0:2])) * int("".join(combination[2:5]))
|
||||
== int("".join(combination[5:9]))
|
||||
) or (
|
||||
int(''.join(combination[0])) *
|
||||
int(''.join(combination[1:5])) ==
|
||||
int(''.join(combination[5:9]))
|
||||
int("".join(combination[0])) * int("".join(combination[1:5]))
|
||||
== int("".join(combination[5:9]))
|
||||
)
|
||||
|
||||
|
||||
@ -50,13 +48,13 @@ def solution():
|
||||
return sum(
|
||||
set(
|
||||
[
|
||||
int(''.join(pandigital[5:9]))
|
||||
for pandigital
|
||||
in itertools.permutations('123456789')
|
||||
int("".join(pandigital[5:9]))
|
||||
for pandigital in itertools.permutations("123456789")
|
||||
if isCombinationValid(pandigital)
|
||||
]
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(solution())
|
||||
|
Reference in New Issue
Block a user