Commit 8bfcffbf by BellCodeEditor

save project

parent c37f120a
Showing with 14 additions and 14 deletions
import random import random
# 玩家出拳 # 玩家出拳
player=input("请出拳(石头;剪刀;布)") while True:
print("玩家出拳:"+player) player=input("请出拳(石头;剪刀;布)")
print("玩家出拳:"+player)
list = ["剪刀","石头","布"] list = ["剪刀","石头","布"]
if player in list: if player in list:
cmp=random.choice(list) cmp=random.choice(list)
print("电脑出拳"+cmp) print("电脑出拳"+cmp)
if player==cmp: if player==cmp:
print("平局") print("平局")
elif player=="剪刀" and cmp=="布 " or player=="石头" and cmp=="剪刀 "or player=="布" and cmp=="石头": elif player=="剪刀" and cmp=="布 " or player=="石头" and cmp=="剪刀 "or player=="布" and cmp=="石头":
print("win") print("win")
else:
print("lose")
else: else:
print("lose") print("输入错误")
else:
print("输入错误")
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