从1到4选出不重复的3个数组成,能有多少种组合

import itertools
a = range(1, 5)
y = list(itertools.permutations(a, 3))
print(y)

输出:
[(1, 2, 3), (1, 2, 4), (1, 3, 2), (1, 3, 4), (1, 4, 2), (1, 4, 3), (2, 1, 3), (2, 1, 4), (2, 3, 1), (2, 3, 4), (2, 4, 1), (2, 4, 3), (3, 1, 2), (3, 1, 4), (3, 2, 1), (3, 2, 4), (3, 4, 1), (3, 4, 2), (4, 1, 2), (4, 1, 3), (4, 2, 1), (4, 2, 3), (4, 3, 1), (4, 3, 2)]

posted @ 2022-08-14 23:14  ty1539  阅读(305)  评论(0编辑  收藏  举报