使用Python买福彩,5个数字,20选5,有没买过

import random,sys,os
num = random.sample(range(1,21),5)
print(num)
f=open("haha.txt","a+")
f.write(str(num)+"\n")
f.close()
person1 = int(input('请输入你要买的数字:'))
person2 = int(input('请输入你要买的数字:'))
person3 = int(input('请输入你要买的数字:'))
person4 = int(input('请输入你要买的数字:'))
person5 = int(input('请输入你要买的数字:'))
if person1 > 20 or person2 > 20 or person3 > 20 or person4 > 20 or person5 > 20:
print("不能输入大于20的数字")
sys.exit()
if person1 == person2 or person1 == person3 or person1 == person4 or person1 == person5 or person2 == person3 or person2 == person4 or person2 == person5 or person3 == person4 or person3 == person5 or person4 == person5:
print("不能购买重复的号码")
sys.exit()
if person2 in num and person3 in num and person4 in num and person5 in num and person1 in num:
print("恭喜你,全中了,奖励320元")
if person1 in num:
if person2 not in num and person3 not in num and person4 not in num and person5 not in num:
print("中了一个,很遗憾没奖励")
if person2 in num and person3 not in num and person4 not in num and person5 not in num:
print("中了两个,很遗憾没奖励")
if person2 in num and person3 in num and person4 not in num and person5 not in num:
print("中三个,很遗憾没奖励")
if person2 in num and person3 in num and person4 in num and person5 not in num:
print("中四个,很遗憾没奖励")
if person2 in num:
if person1 not in num and person3 not in num and person4 not in num and person5 not in num:
print("中了一个,很遗憾没奖励")
if person1 in num and person3 not in num and person4 not in num and person5 not in num:
print("中了两个,很遗憾没奖励")
if person1 in num and person3 in num and person4 not in num and person5 not in num:
print("中三个,很遗憾没奖励")
if person1 in num and person3 in num and person4 in num and person5 not in num:
print("中四个,很遗憾没奖励")
if person3 in num:
if person1 not in num and person2 not in num and person4 not in num and person5 not in num:
print("中了一个,很遗憾没奖励")
if person1 in num and person2 not in num and person4 not in num and person5 not in num:
print("中了两个,很遗憾没奖励")
if person1 in num and person2 in num and person4 not in num and person5 not in num:
print("中三个,很遗憾没奖励")
if person1 in num and person2 in num and person4 in num and person5 not in num:
print("中四个,很遗憾没奖励")
if person4 in num:
if person1 not in num and person2 not in num and person3 not in num and person5 not in num:
print("中了一个,很遗憾没奖励")
if person1 in num and person2 not in num and person3 not in num and person5 not in num:
print("中了两个,很遗憾没奖励")
if person1 in num and person2 in num and person3 not in num and person5 not in num:
print("中三个,很遗憾没奖励")
if person1 in num and person2 in num and person3 in num and person5 not in num:
print("中四个,很遗憾没奖励")
if person5 in num:
if person1 not in num and person2 not in num and person3 not in num and person4 not in num:
print("中了一个,很遗憾没奖励")
if person1 in num and person2 not in num and person3 not in num and person4 not in num:
print("中了两个,很遗憾没奖励")
if person1 in num and person2 in num and person3 not in num and person4 not in num:
print("中三个,很遗憾没奖励")
if person1 in num and person2 in num and person3 in num and person4 not in num:
print("中四个,很遗憾没奖励")
if person1 not in num and person2 not in num and person3 not in num and person4 not in num and person5 not in num:
print("不好意思,一个都没中,要加油哦")

转载于:https://www.cnblogs.com/hahamyroot/p/10221013.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值