“双色球”彩票机选程序

#!/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万

你可能感兴趣的:(C++,c,python,脚本,C#)