- #!/usr/bin/python
- #coding=utf-8
- import sys
- reload(sys)
- sys.setdefaultencoding('utf8')
- no1=['法国',
- '巴西',
- '意大利',
- '西班牙']
- no2=['巴西',
- '德国',
- '法国',
- '荷兰'
- ]
- no3=['克罗地亚',
- '土耳其',
- '德国',
- '德国']
- no4=['荷兰',
- '韩国',
- '葡萄牙',
- '乌拉圭']
- cupOrder={}
- for j in no1:
- cupOrder[j]=4
- for j in no2:
- if j in cupOrder:
- cupOrder[j]+=3
- else:
- cupOrder[j]=3
- for j in no3:
- if j in cupOrder:
- cupOrder[j]+=2
- else:
- cupOrder[j]=2
- for j in no4:
- if j in cupOrder:
- cupOrder[j]+=1
- else:
- cupOrder[j]=1
- order=sorted(cupOrder.iteritems(),key = lambda asd:asd[1] , reverse = True)
- print '近四次世界杯权值最大的国家依次'
- for i in order:
- print i[0].encode('utf8'),i[1]
- #for name,score in cupOrder.items():
- # print '%s at %s' % (name.encode('utf8'), str(score))
- #该片段来自于http://www.codesnippet.cn/detail/130620149776.html
来源: http://www.codesnippet.cn/detail/130620149776.html