1.有 1、2、3、4 个数字,能组成多少个互不相同且无重复数字的三位数?都是多 少?
代码
1 #encoding=utf-8
2 __author__ = ‘heng’
3 #利用1,2,3,4可以组成多少个三位数,并且没有重复数字
4 figure = [1,2,3,4]
5 number = 0
6 for x in figure:
7 for y in figure:
8 if x == y:
9 continue
10 else:
11 for z in figure:
12 if y == z or z == x: #注意是or不是and
13 continue
14 else:
15 number += 1
16 print 100*x + 10*y + z
17 print “the number is %s”%number