Commit 4dcfcf85 by BellCodeEditor

save project

parent 98987ad5
Showing with 16 additions and 12 deletions
import random import random
piayer = input("玩家请出拳:(石头/剪刀/布/)") while True:
print("玩家出拳:+player") player = input("玩家请出拳:(石头/剪刀/布/):")
list = ["石头","剪刀","布"] print("玩家出拳: "+player)
cp = random.choice(list) list=["石头","剪刀","布"]
print("电脑出拳:"+cp) cp=random.choice(list)
if player==cp: print("电脑出拳:"+cp)
print("平局") if piayer in list:
elif player=="石头" and cp=="剪刀" or player=="剪刀" and cp=="布" and cp=="石头": if player==cp:
print("玩家获胜") print("平局")
else: elif player=="石头" and cp=="剪刀" or player=="剪刀" and cp=="布" and cp=="石头":
print("电脑获胜") print("玩家获胜")
\ No newline at end of file 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