I have created a random list of 60 numbers, I don't know the numbers contained in the list. I'm asked to find any combination of three numbers from the list that sum to zero. What can I do? That's my code:
import random
import itertools
result = []
for x in range (-30, 30):
num = random.randint(-30, 30)
while num in result:
num = random.randint(-30, 30)
result.append(num)
result = [seq for i in range(len(result), 0, -1) for seq in itertools.combinations(result, i) if sum(seq) == 0]
print result