Jan-18-2021, 05:18 AM
(This post was last modified: Jan-18-2021, 05:18 AM by deanhystad.)
Use integer 0 through 10 and convert to float when the values are used.
If you want to be really efficient you can do this:
import itertools four = [] for a, b, c in itertools.product(range(11), repeat=3): if (d := 10 - a - b - c) >= 0: four.append([a, b, c, d]) # <- Can convert to float here or when usedThis code generates 1331 combinations of which 286 are valid.
If you want to be really efficient you can do this:
for a in range(11): for b in range(11-a): for c in range(11-a-b): four.append([a, b, c, 10-a-b-c])The inner loop executes 286 times to give you the 286 possible number combinations.