首页 > 其他 > 详细

测开之路二十五:彩票游戏

时间:2019-05-05 22:07:07      阅读:126      评论:0      收藏:0      [点我收藏+]

 

 

玩法

技术分享图片

技术分享图片

import random

money = random.randint(0, 999)

def generate_code(money):
return list(set([
money[0] + money[1] + money[2], money[0]+money[2]+money[1],
money[1] + money[0] + money[2], money[1] + money[2] + money[0],
money[2] + money[0] + money[1], money[2] + money[1] + money[0],
]))

while True:
code = int(input("请选投注的号码[0~999]:"))
if code >= 0 or code <= 999:
break

money = "{0:03}".format(money)
code = "{0:03}".format(code)

while True:
play = int(input("请选择玩法(0-直选 1-组选3 2-组选6):"))
if play in [0, 1, 2]:
if play == 0:
break
elif play == 1 and len(generate_code(code)) == 3:
break
elif play == 2 and len(generate_code(code)) == 6:
break
else:
continue

print("玩法是{0}, 开奖号码是{1}, 选择的号码是{2}".format(play, money, code))
if play == 0:
if money == code:
print("恭喜您中奖1000元!")
else:
print("多买几张吧,提高中奖概率!")
elif play == 1:
zuxuan3 = generate_code(money)
if len(zuxuan3) != 3:
print("多买几张吧,提高中奖概率!")
else:
if code in zuxuan3:
print("恭喜您中奖320元!")
else:
print("多买几张吧,提高中奖概率!")
elif play == 2:
zuxuan6 = generate_code(money)
if len(zuxuan6) != 6:
print("多买几张吧,提高中奖概率!")
else:
if code in zuxuan6:
print("恭喜您中奖160元!")
else:
print("多买几张吧,提高中奖概率!")
else:
print("玩法异常!")

 

测开之路二十五:彩票游戏

原文:https://www.cnblogs.com/zhongyehai/p/10816508.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!