用python实现0到9之间10个数字排列不重复的个数

 
"""
product 笛卡尔积
permutations 排列
combinations 组合,没有重复
combinations_with_replacement 组合,有重复
用itertools.都一个立马搞定,无需多层循环

"""

# 以下完成0,1,2,3,4,5,6,7,8,9排列不重复的个数

import itertools
data=[]
for i in itertools.permutations('1234567890',10):
    if i[0] !='0':
        data.append("".join(i))

print(len(data))

 

 
posted @ 2017-05-23 16:37  Ranxf  阅读(5380)  评论(0编辑  收藏  举报