how to get all combinations between 1 2 3 4 5 6 7 8 using each number once python -
first of inform don't have knowledge python. tryed figure basics searching trough beginner tutorials can't wrap head around those.
as have specific thing i'd generate hope theres on here me out.
i need possible combinations between numbers 1,2,3,4,5,6,7,8 first , last number have 1 , numbers can't used twice.
for example:
1 2 3 4 5 6 7 8 1 - 1 2 3 4 5 6 8 7 1 - 1 2 3 4 5 7 8 6 1 - 1 2 3 4 5 7 6 8 1 - 1 2 3 4 5 8 6 7 1 - 1 2 3 4 5 8 7 6 1 -
and on :)
from itertools import permutations in permutations(range(2, 9)): = (1,) + + (1,) print(a)
for learning more try this: how-to-generate-all-permutations-of-a-list-in-python
Comments
Post a Comment