每次买双色球特别难选号,有木有?每次运行一次本程序就OK啦,祝大家发大财:
#!/usr/bin/python
import random
from time import clock
count=int(input("你要买几注:"))
indexout = 0
arry1 = []
while indexout<count:
##蓝色球部分
indexin=0
while indexin <= 5:
rand=random.randint(1,32)
if rand not in arry1:
arry1.insert(indexin,rand)
indexin += 1
arry1.sort()
##红色球部分
arry1.insert(6,'|')
arry1.insert(len(arry1),random.randint(1,16))
print(arry1)
arry1.clear()
indexout+=1
运行结果:
/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 /Users/LeonYan/PycharmProjects/Leon/Src/LoginCount.py
你要买几注:5
[9, 12, 14, 20, 22, 31, '|', 10]
[7, 11, 19, 21, 24, 31, '|', 8]
[8, 15, 23, 24, 26, 31, '|', 6]
[3, 8, 16, 18, 22, 30, '|', 6]
[3, 8, 17, 25, 26, 29, '|', 11]
Process finished with exit code 0