Commit 09047641 by BellCodeEditor

auto save

parent a0cbfb52
Showing with 25 additions and 2 deletions
# 玩家出拳
\ No newline at end of file
import random
# 玩家出拳
player = input("请输入剪刀/石头/布")
print("玩家出:" + player)
# “ + ” 对相同数值类型的值进行运算
#计算机随机出拳
ls = ["剪刀","石头","布"]
computer = random.choice(ls)
print( "计算机出:" + computer )
#显示结果
if player in ls:
if computer == player :
print("平局")
elif computer == "布" and player == "剪刀":
print("我赢了")
elif computer == "剪刀" and player == "石头":
print("我赢了")
elif computer == "石头" and player == "剪刀":
print("我赢了")
else:
print("我输了")
else:
print("输入错误")
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