用简单的Python语句写了个模拟双色球摇奖,希望能中。。

import random; #利用Python中的random.sample()函数实现
resultList = random.sample(range(1, 34), 6); #sample(x,y)函数的作用是从序列x中,随机选择y个不重复的元素
resultList.sort() #从低到高排序
print(“红球的号码为:”+ str(resultList)) # 打印结果
resultList1=random.sample(range(1,17),1)
print(“蓝球的号码为:”+ str(resultList1 )) # 打印结果

用简单的Python语句写了个模拟双色球摇奖,希望能中。。希望大家都可以中哈~

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
  • 2021-05-25
  • 2022-12-23
  • 2021-11-05
  • 2022-12-23
  • 2021-12-26
猜你喜欢
  • 2022-12-23
  • 2021-05-07
  • 2021-11-30
  • 2021-07-17
  • 2022-12-23
  • 2021-09-10
相关资源
相似解决方案