def creat_num():
nums = [] for i in range(6):
# print(randint(1,33)) while True:
num = randint(1, 33) if num not in nums:
nums.append(num) break blueball = randint(1, 16)
def pan_duan(nums,buy_nums):
# nums=[1,3,7,12,25,28,1]
# buy_nums=[1,2,6,11,24,27,2]
redball=0
blueball=0 for i in buy_nums[:-1]: #判断红球中了多少个 if i in nums[:-1]:
redball+=1 if buy_nums[-1]==nums[-1]: #判断篮球是否中奖
blueball+=1
#判断中了几等奖?
"""
一等奖:6+1
redball==6 and blueball=1
二等奖:6+0
redball==6 and blueball=0
三等奖:5+1
redball==5 and blueball=1
四等奖:5+0 或 4+1
redball==5 and blueball=0 or redball==4 and blueball=1
五等奖:4+0 或3+1
redball==4 and blueball=0 or redball==3 and blueball=1
六等奖:2+1 或 1+1 或 0+1
redball==2 and blueball=1 or redball==1 and blueball=1 or redball==0 and blueball=1
""" if redball==6 and blueball==1: return 1 elif redball==6: return 2 elif redball == 5 and blueball == 1: return 3 elif (redball == 5 and blueball == 0) or (redball == 4 and blueball == 1): return 4 elif (redball == 4 and blueball == 0) or (redball == 3 and blueball == 1): return 5 elif (redball == 4 and blueball == 0) or (redball == 3 and blueball == 1) or blueball==1: return 6 else:
#print("很遗憾,您未中奖!") return 0