【Python日记】数字排列(一)-河图数字

有0、1、2、3四个数字,能组成多少个互不相同且无重复数字的三位数?
输出这些三位数。

 

list1 = [0,1,2,3]
a = 0
for m in list1:
	for n in list1:
		for x in list1:
			c = m,n,x
			e = str(c[0])+str(c[1])+str(c[2])
			if e[0] != e[1] and e[1] != e[2] and e[0] != e[2]:
				print(e)
				a += 1
			else:
				pass
print('共有',a,'位数字')