【发布时间】:2013-07-09 23:47:32
【问题描述】:
我的任务是创建一个程序,帮助人们为彩票选择随机数,我不知道从哪里开始。程序必须:
- 允许玩家在 1 - 5 行之间进行选择。
- 每行 6 个数字。
- 每个数字必须介于 1-49 之间。
- 还有一个重复选项。
这就是我目前所拥有的:
lines=int(input("how many lines would you like?"))
for i in range (0,lines):
import random
lotterynumbers = []
x = 0
while x < 6:
lotterynumbers.append(random.randint(1, 49))
x += 1
lotterynumbers.sort()
print (lotterynumbers)
请帮忙。
【问题讨论】:
-
如果这是家庭作业,您应该添加
homework标签。
标签: loops random python-3.x