30 不重复的三位数

it2022-05-06  0

0-9可以组成多少不重复三位数

拆分 n = a*100 + 10*b + c   abc

代码如下:

1 #!/usr/bin/env python 2 # encoding: utf-8 3 """ 4 @author: 侠之大者kamil 5 @file: 30 不重复的三位数.py 6 @time: 2016/5/23 15:53 7 """ 8 l = range(4) 9 cont = 0 10 for a in l[1:]: 11 for b in l: 12 if a == b:continue #过滤a=b 13 for c in l: 14 if c !=a and c !=b: 15 print(a,b,c) 16 cont += 1 17 print('一共出现:',cont) 18 19 def func(): 20 pass 21 22 23 if __name__ == '__main__': 24 pass

 

转载于:https://www.cnblogs.com/kamil/p/5520339.html


最新回复(0)