满意答案
#!/usr/bin/python
# -*- coding:utf-8 -*-
# @File : ThreeNum.py
"""
输入3个数,对三个数进行排列组合
"""
def percom(olist):
import copy
slist = []
olen = len(olist)
for i in range(olen):
otemp = olist[i]
slist.append(otemp*olen)
temp = copy.deepcopy(olist)
temp.remove(otemp)
slist.append(otemp+temp[0]+temp[1])
slist.append(otemp+temp[1]+temp[0])
else:
oset = set(slist)
result = sorted(list(oset), reverse=True)
counts = len(result)
return counts, result
if __name__ == '__main__':
alist = raw_input(u'请输入三个数字,以英文逗号相隔(2,3,4):').split(',')
print u'组合数为:{0}\n分别是:{1}'.format(percom(alist)[0], percom(alist)[1])
00分享举报