Commit 54662c4f by BellCodeEditor

save project

parent 4f883847
Showing with 9 additions and 5 deletions
import random import random
print("输入正确") c=["剪刀","石头","布"]
a=input("请出拳:(石头/剪刀/布)")# 玩家出拳 b=random.choice(c)
print("玩家出拳"+a)
while True: while True:
a=input("请出拳:(石头/剪刀/布)")# 玩家出拳
print("玩家出拳"+a)
if a in c: if a in c:
c=["剪刀","石头","布"]
b=random.choice(c)
print("计算机出,"+b) print("计算机出,"+b)
if a==b: if a==b:
print("平局") print("平局")
break
elif (a=="剪刀" and b=="布") or (a=="石头" and b=="剪刀") or (a=="布" and b=="石头"): elif (a=="剪刀" and b=="布") or (a=="石头" and b=="剪刀") or (a=="布" and b=="石头"):
print("玩家赢") print("玩家赢")
break
else : else :
print("计算机赢") print("计算机赢")
break
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