Commit bef143f0 by BellCodeEditor

save project

parent 58327458
Showing with 24 additions and 16 deletions
player=input("请出拳:石头/剪刀/布")# 玩家出拳
print("玩家出拳:"+player)
import random import random
list=["石头","剪刀","布"] while True:
computer=random.choice(list) player=input("请出拳:石头/剪刀/布")# 玩家出拳
print("计算机出拳",computer) print("玩家出拳:"+player)
if player==computer:
print("平局") list=["石头","剪刀","布"]
elif player=="石头" and computer=="剪刀": computer=random.choice(list)
print("玩家赢了") print("计算机出拳",computer)
elif player=="剪刀" and computer=="布": if player in list:
print("玩家赢了") if player==computer:
elif player=="布" and computer=="石头": print("平局")
print("玩家赢了") elif player=="石头" and computer=="剪刀":
else: print("玩家赢了")
print("计算机赢了") break
\ No newline at end of file elif player=="剪刀" and computer=="布":
print("玩家赢了")
break
elif player=="布" and computer=="石头":
print("玩家赢了")
break
else:
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