Pyhton之模拟石头剪子布游戏篇

石头剪子布游戏规则:石头>剪子来,剪子>布,布>石头。如果双方出示了一样的手势,就是平局。

# coding       :UTF_8
# 开发团队      :心心相印
# 开发人员      :机器人小白
# 开发时间      :2020/5/31 17:19
# 文件名称      :AC_4_5.py
# 开发工具      :PyCharm

# 模拟石头剪子布游戏
# 规定数字1代表石头,数字2代表剪子,数字3代表布
a = int(input('3,2,1,请出:'))
if (a>3 or a<1):
    print('error')
    a = int(input('3,2,1,请重新出:'))
b = int(input('3,2,1,请出:'))
if (b>3 or b<1):
    print('error')
    b = int(input('3,2,1,请重新出:'))

if (a==1 and b==2):
    print('a获胜!')
elif (a==1 and b==3):
    print('b获胜!')
elif (a==2 and b==1):
    print('b获胜!')
elif (a==2 and b==3):
    print('a获胜!')
elif (a==3 and b==1):
    print('a获胜')
elif (a==3 and b==2):
    print('b获胜!')
else:
    print('平局!')


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值