新建python 文件double-color-balls-random.py
import random
def redBalls(number, start, end):
a = []
while True:
while True:
temp = random.randint(start, end)
if temp in a:
continue
else:
a.append(temp)
break
if len(a) == number:
break
a.sort()
return a
def blueBall(start, end):
return random.randint(start,end)
print('欢迎使用双色球随机生成器,必中500万!')
print('回车生成第一注')
while input()!='n':
redNumbers = redBalls(6,1,33)
blueNumber = blueBall(1,16)
print(redNumbers, end=' + ')
print(blueNumber)
print('回车再来一注,n键回车退出')