# 简述:这里有四个数字,分别是:1、2、3、4#提问:能组成多少个互不相同且无重复数字的三位数?各是多少?def f(n): list=[] count=0 for i in range(1,n+1): for j in range(1, n+1): for k in range(1, n+1): if i!=j and j!=k and i!=k: list.append(i*100+j*10+k) count=len(list) print count return list if __name__=="__main__": print f(4)
24[123, 124, 132, 134, 142, 143, 213, 214, 231, 234, 241, 243, 312, 314, 321, 324, 341, 342, 412, 413, 421, 423, 431, 432]