Commit 2da8a376 by BellCodeEditor

save project

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