-1
In this list the combinations appear. But I can’t enumerate them. and when I printed the last sum total of 520. I don’t know what I’m doing wrong.
from itertools import combinations
lis = [25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46]
for i in (10, len(lis)):
for comb in combinations(lis, i):
if sum(comb) >= 280 <= 520:
for c in enumerate(comb):
print(comb)
for i in (10, len(lis))
, could revise this line?– Woss
What exactly is the purpose of the program? What should it do?
– Woss
Actually it’s for an example on the mega sena. Scroll through all 60 numbers. This example did not put the 60 numbers. Where the total of the 10 selected is 280 and 520 and each line is enumerated.
– Peçanha De Oliveira Eduardo
So basically generate all the combinations of the 60 numbers, taken 10 to 10, where the sum is between 280 and 520?
– Woss
Indicating the amount of line that contains every generated list.
– Peçanha De Oliveira Eduardo
Not necessarily 10 to 10. Each row without being repeated from the generated list the sum of 280 in distinct positions up to the sum of 520 with different positions.
– Peçanha De Oliveira Eduardo
What you’re saying is not making any sense to me :( Is this an exercise? If it is, it would be better to post the full statement.
– Woss
Where do these magic numbers come from
280
and520
??– Lacobus