Created
March 14, 2022 17:45
-
-
Save dreisicht/52baa8b273e0ce06ea6a49cbeeb94cd8 to your computer and use it in GitHub Desktop.
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
def get_according_elements(list_ipt): | |
list_of_results = [] | |
for base_el in range(len(list_ipt)): | |
if list_ipt[base_el] < 0: | |
continue | |
for el2 in range(len(list_ipt)): | |
if list_ipt[el2] > 0 or base_el == el2: | |
continue | |
if list_ipt[base_el] + list_ipt[el2] == 0: | |
list_of_results.append([list_ipt[base_el], list_ipt[el2]]) | |
for el3 in range(len(list_ipt)): | |
if list_ipt[el3] > 0 or el2 == el3: | |
continue | |
if list_ipt[base_el] + list_ipt[el2] + list_ipt[el3] == 0: | |
list_of_results.append([list_ipt[base_el], list_ipt[el2], list_ipt[el3]]) | |
for el4 in range(len(list_ipt)): | |
print(base_el, el2, el3, el4) | |
if list_ipt[el4] > 0 or el3 == el4: | |
continue | |
if list_ipt[base_el] + list_ipt[el2] + list_ipt[el3] + list_ipt[el4] == 0: | |
list_of_results.append([list_ipt[base_el], list_ipt[el2], list_ipt[el3], list_ipt[el4]]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment