用Python函数random随机生成一注:双色球,大乐透,排列五
代码如下:
import random
a = random.sample(range(34), 6)
b = random.sample(range(17), 1)
print(“双色球:” + str(a) + " " + str(b))
c = random.sample(range(36), 5)
d = random.sample(range(13), 2)
print(“大乐透” + str© + " " + str(d))
d = random.sample(range(10), 5)
print(“排列五:” + str(d))
运行结果:
双色球:[28, 14, 5, 23, 20, 4] [8]
大乐透[4, 28, 1, 25, 21] [5, 8]
排列五:[6, 5, 1, 9, 7]
Process finished with exit code 0