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

bellcode / lesson2-2_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
Commit 7be1aedd authored 4 years ago by BellCodeEditor's avatar BellCodeEditor
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

save project

parent b1e8b6b7
Show whitespace changes
Inline Side-by-side
Showing with 3 additions and 3 deletions
  • diy1.py
diy1.py
View file @ 7be1aedd
......@@ -5,14 +5,14 @@ list1=['石头','剪刀','布']
comp = [('石头', '剪刀'), ('剪刀', '布'), ('布', '石头')]
# 玩家出拳
player=input(f"please play with the computer:, {'/'.join(list1)}")
print("your ansuer is:", player)
print("你出的拳是:", player)
# 判断是否出正确的拳
if player not in list1:
print(f'Error: your answer not in {list1}')
print(f'Error: 你的答案不在 {list1}')
else:
# 电脑随机出拳
com=random.choice(list1)
print("com is:", com)
print("计算机出的拳是:", com)
# 如果 (玩家出拳, 电脑出拳) 在胜利选项内,则胜利
if (player, com) in comp:
print(f'{player} killed {com}, You won!')
......
This diff is collapsed. Click to expand it.
  • Write
  • Preview
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment