`
Suninny
  • 浏览: 37724 次
  • 性别: Icon_minigender_1
  • 来自: 长沙
最近访客 更多访客>>
社区版块
存档分类
最新评论

“双色球”彩票机选程序

阅读更多
#!/usr/bin/env python
# coding:utf-8
# 双色球机选脚本
# Copyright(C) 2008 http://sunniny.iteye.com

from random import sample, choice

N = 5
red = range(1, 33) #红球
blue = range(1, 16) #蓝球

lots = []
for x in range(N):
    lots.append(sorted(sample(red, 6)) + [choice(blue)])

for n, l in enumerate(lots):
    i = 1
    print "%c:" % chr(65+n),
    for x in l:
        if i == 7:
            print "-%02d" % x,
        else:
            print "%02d" % x,
        i += 1
    print
 
输出样例:

A: 06 14 15 18 20 27 -02
B: 06 09 18 19 21 32 -07
C: 06 10 18 20 24 31 -12
D: 01 12 15 20 23 25 -10
E: 02 03 07 08 11 29 -03

下次就用自己的脚本来选号了,哈哈...偶的500万

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics