Commit 2da8a376 by BellCodeEditor

save project

parent f65a9fb4
Showing with 14 additions and 12 deletions
import random import random
p=input("请出拳:石头/剪刀/布")# 玩家出拳 玩家=input("请出拳:石头/剪刀/布")# 玩家出拳
print("玩家出拳:"+p) print("玩家出拳:"+玩家)
w=["石头","剪刀","布"] 电脑=["石头","剪刀","布"]
e=random.choice(w) 电脑出拳=random.choice(电脑)
print("电脑出拳:"+e) print("电脑出拳:"+电脑出拳)
if p==e: if 玩家 in 电脑:
print("平局") if 玩家==电脑出拳:
elif p=="石头" and e=="剪刀" or p=="布" and e=="石头" or p=="剪刀" and e=="布": print("平局")
print("玩家赢") elif 玩家=="石头" and 电脑出拳=="剪刀" or 玩家=="布" and 电脑出拳=="石头" or 玩家=="剪刀" and 电脑出拳=="布":
else: print("玩家赢")
print("玩家输") else:
\ No newline at end of file print("玩家输")
else: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