生成5+2, 6+1的随机数
import random def getBaseBigHapppyNumbers(): frontNumbers = set(); backNumbers = set(); while(len(frontNumbers)<5): cur = random.randint(1, 35) frontNumbers.add(cur) while(len(backNumbers)<2): cur = random.randint(1, 12) backNumbers.add(cur) sorted(frontNumbers) sorted(backNumbers) print("随机的组合为:") print(frontNumbers) print(backNumbers) def getDoubleColorBall(): frontNumbers = set(); backNumbers = set(); while(len(frontNumbers)<6): cur = random.randint(1, 33) frontNumbers.add(cur) while(len(backNumbers)<1): cur = random.randint(1, 16) backNumbers.add(cur) sorted(frontNumbers) sorted(backNumbers) print("随机的组合为:") print(frontNumbers) print(backNumbers) if __name__ == '__main__': getBaseBigHapppyNumbers() getDoubleColorBall()