问题描述
我正在做排列,我想以一种特定的方式打印结果。
我的代码:
from itertools import permutations as p
n = 3 #This can be change
permu_lst = [i for i in p(range(1,n+1)]
for a,b,c in permu_lst:
print(a,c)
Output:
1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1
所以我的问题是,n
更改时,如何自动执行for循环以打印结果。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)