Commit 7051e7c0 by BellCodeEditor

auto save

parent 220fe62b
Showing with 28 additions and 0 deletions
import random
num = 0
for i in range(3):
#玩家出的
player = input("请你出(剪刀/石头/布):")
print("你出的是:" + player)
#电脑出的
list = ["剪刀","石头","布"]
computer = random.choice(list)
print("电脑出的是:" + computer)
#比较的代码块
if player in list :
if player == computer :
print("平局哦~")
elif (player == "剪刀" and computer == "布") or (player == "石头" and computer == "剪刀") or (player == "布" and computer == "石头"):
print("你赢了哦~")
num +=1
else :
print("你输了哦")
else :
print("输入错误")
#输出分数
print("玩了三盘 赢了"+str(num)+"盘")
\ 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