Commit dd524958 by BellCodeEditor

save project

parent cf0ea5bc
Showing with 20 additions and 11 deletions
import random
a=input("石头,剪刀,布:")# 玩家出拳
print("出"+a)
b=["石头","剪刀","布"]
c=random.choice(b)
print("出"+c)
if a==c:
print("平局")
elif (a=="石头" and c=="剪刀") or (a=="剪刀" and c=="布") or (a=="布" and c=="石头"):
print("恭喜,你胜利了")
else:
print("很遗憾,你失败了")
while True:
a=input("石头,剪刀,布:")# 玩家出拳
print("出"+a)
if a in b:
c=random.choice(b)
print("出"+c)
#z=["剪刀","石头","布"]
if a==c:
print("平")
break
elif (a=="剪刀" and c=="布") or (a=="布" and c=="石头") or (a=="石头" and c=="剪刀"):
print("赢")
break
else:
print("输")
break
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