Commit 309c2f3c by BellCodeEditor

save project

parent 91c91b7f
Showing with 19 additions and 13 deletions
import random import random
player=input("石头,剪刀,布") d=0
list=["石头","剪刀","布"] while True:
computer=random.choice(list) player=input("石头,剪刀,布")
print("玩家出拳"+player) list=["石头","剪刀","布"]
print("电脑出拳"+computer) computer=random.choice(list)
if player in list: print("玩家出拳"+player)
if player==computer: print("电脑出拳"+computer)
print("平局") if player in list:
elif (player=="石头" and computer=="剪刀") or (player=="布" and computer=="石头") or (player=="剪刀" and computer=="布"): if player==computer:
print("player win") print("平局")
elif (player=="石头" and computer=="剪刀") or (player=="布" and computer=="石头") or (player=="剪刀" and computer=="布"):
print("player win")
d=d+1
if d==3:
break
else:
print("computer win")
else: else:
print("computer win") print("输入错误")
else:
print("输入错误")
\ No newline at end of file
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