代码如下
'''
打印 1-4 组成的,无重复且每位数字不等的 3 位数
@Version: v0.1, Python 3.9.5, Notus(hehe_xiao@qq.com), 2021.05.26
@Updated: 2021.05.26
'''
for i in range(1, 5):
for j in range(1, 5):
for k in range(1, 5):
if i != j and j !=k and k != i:
print(i * 100 + j * 10 + k, end=", ")
print("")
运行结果
123, 124, 132, 134, 142, 143, 213, 214, 231, 234, 241, 243, 312, 314, 321, 324, 341, 342, 412, 413, 421, 423, 431, 432,