选号规则:前区1-35的范围随机产生不重复的5个号码,后区在1-12范围内随机生成2个不重复的2个号码。如下:
import random
def number():
front = [str(random.randint(1,35) )for i in range(5)]
back = [str(random.randint(1,12)) for i in range(2)]
space = [" "*6]
group = front + space + back
for i in group:
print(i.zfill(2),end=" ")
print("大乐透号码生成器")
amount = int(input("请输入要生成的大乐透号码注数:"))
for i in range(amount):
number()
print("")
初学者,欢迎各位提提优化意见