Commit 4dfb9a9f by BellCodeEditor

save project

parent 8aead555
Showing with 15 additions and 14 deletions
import random
num=0
while num<4:
a=input("我出拳是: ")
gn=["石头","剪刀","布"]
print("出的拳是:"+a)
b=random.choice(gn)
print("计算机出拳: "+b)
if a in gn:
if a==b:
print("平局")
elif (a=="石头" and b=="剪刀") or (a=="剪刀" and b=="布") or (a=="布" and b=="石头"):
print("我赢了")
while num<3:
a=input("我出拳是: ")
gn=["石头","剪刀","布"]
print("出的拳是:"+a)
b=random.choice(gn)
print("计算机出拳: "+b)
if a in gn:
if a==b:
print("平局")
elif (a=="石头" and b=="剪刀") or (a=="剪刀" and b=="布") or (a=="布" and b=="石头"):
print("我赢了")
num=num+1
else:
print("计算机赢了")
else:
print("计算机赢了")
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