Commit c37f120a by BellCodeEditor

save project

parent d3524c2c
Showing with 11 additions and 8 deletions
...@@ -2,12 +2,16 @@ import random ...@@ -2,12 +2,16 @@ import random
# 玩家出拳 # 玩家出拳
player=input("请出拳(石头;剪刀;布)") player=input("请出拳(石头;剪刀;布)")
print("玩家出拳:"+player) print("玩家出拳:"+player)
list = ["剪刀","石头","布"] list = ["剪刀","石头","布"]
cmp=random.choice(list) if player in list:
print("电脑出拳"+cmp) cmp=random.choice(list)
if player==cmp: print("电脑出拳"+cmp)
print("平局") if player==cmp:
elif player=="剪刀" and cmp=="布 " or player=="石头" and cmp=="剪刀 "or player=="布" and cmp=="石头": print("平局")
print("win") elif player=="剪刀" and cmp=="布 " or player=="石头" and cmp=="剪刀 "or player=="布" and cmp=="石头":
print("win")
else:
print("lose")
else: else:
print("lose") print("输入错误")
\ No newline at end of file
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