Commit 4d9f7457 by BellCodeEditor

save project

parent 0a2f2d1d
Showing with 18 additions and 15 deletions
# 玩家出 # 玩家出
a1=input("请你出拳,石头,剪刀,布") ab=input("请你出拳,石头,剪刀,布")
print("玩家出拳"+a1) print("玩家出拳"+ab)
import random import random
a3=["石头","剪刀","布"] abcd=["石头","剪刀","布"]
a2=(random.choice(a3)) a2=(random.choice(abcd))
print("电脑出:"+a2) print("电脑出:"+a2)
if a1==a2:
print("平局") if ab in abcd:
elif a1=="剪刀" and a2=="布": if ab==a2:
print("玩家赢了") print("平局")
elif a1=="布" and a2=="石头": elif ab=="剪刀" and a2=="布":
print("玩家赢了") print("玩家赢了")
elif a1=="石头" and a2=="剪刀": elif ab=="布" and a2=="石头":
print("玩家赢了") print("玩家赢了")
elif ab=="石头" and a2=="剪刀":
print("玩家赢了")
else:
print("电脑赢了")
else: else:
print("电脑赢了") 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