python -求排列

tech2024-11-21  17

from itertools import permutations def set_permu(s, n): c = permutations(s, 2) return list(c) s = {1, 2, 3} n = 2 set_permu(s, n) [(1, 2), (1, 3), (2, 1), (2, 3), (3, 1), (3, 2)]
最新回复(0)