Commit 6cd2dbff by BellCodeEditor

save project

parent 16f7b04a
Showing with 11 additions and 7 deletions
import random import random
piayer = input("请出拳(石头、剪刀、布):") piayer = input("请出拳(石头、剪刀、布):")
print("玩家出拳:"+piayer) print("玩家出拳:"+piayer)
lits=["石头","剪刀","布"] list=["石头","剪刀","布"]
NPC=random.choice(lits) NPC=random.choice(list)
print("计算机出拳:"+NPC) print("计算机出拳:"+NPC)
if piayer==NPC: if piayer in list:
if piayer==NPC:
print("平局") print("平局")
elif piayer=="石头"and NPC=="剪刀": elif piayer=="石头"and NPC=="剪刀":
print("玩家获胜") print("玩家获胜")
elif piayer=="剪刀"and NPC=="布": elif piayer=="剪刀"and NPC=="布":
print("玩家获胜") print("玩家获胜")
elif piayer=="布"and NPC=="石头": elif piayer=="布"and NPC=="石头":
print("玩家获胜") print("玩家获胜")
else: else:
print("计算机获胜") 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