• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
尚书房的爱
博客园    首页    新随笔    联系   管理    订阅  订阅

python小游戏,石头/剪子/布

#从控制台输入石头(1)/剪子(2)/布(3)

player=int(input("玩家出拳 石头(1)/剪子(2)/布(3)"))

#电脑随机出拳 computer

computer == 1

print("玩家出的拳是%d - 电脑出的拳是%d" %(player , computer))

#玩家选择出拳%d player 

if (player == 1 and computer == 2)or(player == 2 and computer == 3)or( player == 3 and computer == 1):

  print("电脑弱爆了")

 

#比较胜负

elif player =computer:

  print("心有灵犀,再来一局")

#平局

#电脑胜出

else:

print("电脑胜出")

 

posted on 2018-11-26 11:29  尚书房的爱  阅读(195)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3