zoukankan      html  css  js  c++  java
  • python-----双色球实现(实例1)

    #输出用户指定组数的双色球信息,其中一组信息 6个红色号码获取范围(1-33),1个蓝色号码获取范围(1-16),要求一组信息中红球内号码不可重复


    import random
    def get_ball():
    list_red = []
    list_blue = []
    while len(list_red) <6 :
    i=random.randint(1, 33)
    if i not in list_red:
    list_red.append(str(i).zfill(2))
    list_blue.append(str(random.randint(1,16)).zfill(2))
    print("红球 %s 蓝球 %s" %(list_red,list_blue))


    num=input("请输入获取组数:")
    if num.isdigit():
    for i in range(int(num)):
    get_ball()
    else:
    print("请输入数字")
  • 相关阅读:
    poj 2391 Ombrophobic Bovines
    混合欧拉回路poj 1637 Sightseeing tour
    POJ1149-PIGS
    C
    B
    A
    C
    B
    A
    O
  • 原文地址:https://www.cnblogs.com/wenchengqingfeng/p/9303768.html
Copyright © 2011-2022 走看看