Commit 8aead555 by BellCodeEditor

save project

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