Created
May 22, 2022 04:56
-
-
Save washingweb/827928a24c2a4e550d7fa61b409c7151 to your computer and use it in GitHub Desktop.
A quiz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import product | |
def factor(n): | |
"""I don't know the english name""" | |
for i in range(1, n+1): | |
if n % i == 0: | |
yield i | |
search_space = product(factor(48), factor(100), factor(92), factor(128)) | |
for x, y, z, m in search_space: | |
if x*(y+z+m) == 48 and \ | |
y*(x+z+m) == 100 and \ | |
z*(x+y+m) == 92 and \ | |
m*(x+y+z) == 128: | |
print(x, y, z, m) | |
break | |
print("Solution not found") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment