Last active
September 12, 2019 05:32
-
-
Save ebraminio/212feffe590791da896f66fdb87ce48f to your computer and use it in GitHub Desktop.
This file contains 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
# coding: utf-8 | |
# <img src="criterion.jpg" width=400> | |
# In[1]: | |
def criteria1(x, y, z): | |
return x == 6 or y == 8 or z == 2 | |
def criteria2(x, y, z): | |
number = [6, 1, 4] | |
return ((x in number and x != number[0]) or | |
(y in number and y != number[1]) or | |
(z in number and z != number[2])) | |
def criteria3(x, y, z): | |
number = [2, 0, 6] | |
return (((x in number) + (y in number) + (z in number)) == 2 | |
and x != number[0] | |
and y != number[1] | |
and z != number[2]) | |
def criteria4(x, y, z): | |
number = [7, 3, 8] | |
return x not in number and y not in number and z not in number | |
def criteria5(x, y, z): | |
number = [7, 8, 0] | |
return ((x in number and x != number[0]) or | |
(y in number and y != number[1]) or | |
(z in number and z != number[2])) | |
[(x, y, z) | |
for x in range(0, 9) | |
for y in range(0, 9) | |
for z in range(0, 9) | |
if all(f(x, y, z) for f in [criteria1, criteria2, criteria3, criteria4, criteria5])] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment