Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

bellcode / lesson2-5_DIY1

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Switch branch/tag
  • lesson2-5_DIY1
  • diy1.py
Find file
BlameHistoryPermalink
  • BellCodeEditor's avatar
    auto save · b2a52cdd
    BellCodeEditor committed 2 years ago
    b2a52cdd
diy1.py 877 Bytes
Edit
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
import random
player=input("请出拳:石头/剪刀/布")# 玩家出拳
print("玩家出拳:"+player)
list=["石头","剪刀","布"]
if player in list:
    j=random.choice(list)
    print("机器人出拳:"+j)
    if player =="剪刀":
        if j =="剪刀":
            print("平局")
        if j =="石头":
            print("机器人赢了")
        if j =="布":
            print("人赢了")
    if player =="石头":
         if j =="剪刀":
             print("人赢了")
         if j =="石头":
              print("平局")
         if j =="布":
              print("机器人赢了")
    if player =="布":
         if j =="剪刀":
              print("机器人赢了")
         if j =="石头":
               print("人赢了")
         if j =="布":
              print("平局") 
else:
    print("你输入错误")