import random def lottery(): result = [] for i in range(0,6): red = random.randint(1, 33) result.append(red) blue = random.randint(1, 16) result.append(blue) if len(set(result))==len(result): return (result) else: return lottery() if __name__ == "__main__": print(lottery())
前六位是红球,最后一位是篮球;