python双色球生成器,祝大家中头彩

import random

class Lucky_ball:


    def __init__(self,red_num, red_max, blue_num, blue_max ):
        self.red_num = red_num
        self.red_max = red_max
        self.blue_num = blue_num
        self.blue_max = blue_max

    def luck_coming(self):
        i = 0
        # 想要多少注只需要改变i
        while i < 1:
            redList = range(1,self.red_num+1)
            redReal = random.sample(redList,self.red_max)
            redReal = sorted(redReal)
            blueList = range(1,self.blue_num+1)
            blueReal = random.sample(blueList,self.blue_max)
            print('红球:',redReal,'蓝球:',blueReal)
            i += 1

Luck_best = Lucky_ball(33, 6, 16, 1)
Luck_best.luck_coming()

你可能感兴趣的:(python)