Commit e10a2365 by BellCodeEditor

save project

parent 33079120
Showing with 22 additions and 5 deletions
# 这是一款人机板的石头剪刀布游戏
# 开始->玩家出拳->计算机出拳->比较结果
import random
# 玩家出拳
computer_guess = ["剪刀","石头","布"]
quan = input("请选择:")
print("你出的是:"+quan)
if quan not in computer_guess:
print("输入有误")
else:
print("quan:"+quan)
print("你出的是:"+quan)
import random
guess_list = ["剪刀","石头","布"]
print(random.choice(guess_list))
\ No newline at end of file
# 计算机出拳
computer = random.choice(computer_guess)
print("computer:" + computer)
# 结果比较
if quan == computer:
print("平局")
elif (quan == "石头" and computer == "剪刀") or (quan == "剪刀" and computer == "布") or (quan == "布" and computer == "石头"):
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