Created
October 15, 2022 23:44
-
-
Save galenseilis/14b90e3abcf87e7b83eb5bd1f13c3989 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
from more_itertools import set_partitions | |
S = set(range(1,6)) | |
for i in S: | |
s_i = S - {i} | |
for left, right in set_partitions(s_i, 2): | |
if len(left) == len(right) and sum(left) + i == 9 and sum(right) + i == 9: | |
print(i, left, right) | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment