Commit f829719a by BellCodeEditor

save project

parent a0cbfb52
Showing with 30 additions and 2 deletions
# 玩家出拳 # 玩家出拳
\ No newline at end of file player = input("请出拳(剪刀/石头/布):")
#显示玩家出拳结果
print("玩家出拳:"+player)
#导入随机模块
import random
#建立列表
list = ["石头","剪刀","布"]
#计算机出拳
computer = random.choice(list)
"""
#作弊程序
if player == "剪刀":
computer = "石头"
elif player == "石头":
computer = "布"
elif player == "布":
computer = "剪刀"
"""
#显示结果
print("计算机出拳:"+computer)
if player in list:
if player == computer:
print("平局")
elif (player == "石头"and computer == "剪刀") or (player == "剪刀"and computer == "布") or (player == "布" and computer == "石头"):
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