"""题目:有四个数字:1、2、3、4,能组成多少个互不相同且无重复数字的三位数?各是多少?
程序分析:可填在百位、十位、个位的数字都是1、2、3、4。组成所有的排列后再去掉不满足条件的排列。"""
# 三种实现方法
for i in range(1, 433):
i = str(i)
if len(i) == 3:
if i[1] not in ['', '', '', '', '', ''] and i[2] not in ['', '', '', '', '', '']:
if i[0] not in i[1] and i[0] not in i[2] and i[1] not in i[2]:
print(i)
for a in range(1, 5):
for b in range(1, 5):
for c in range(1, 5):
if a != b and a != c and b != c:
print(a, b, c)
list_num = [1, 2, 3, 4]
for i in list_num:
for j in list_num:
for k in list_num:
if j != i and k != j and k != i:
print(i*100+j*10+k)