Commit c45bc747 by BellCodeEditor

auto save

parent a0cbfb52
Showing with 15 additions and 2 deletions
# 玩家出拳 # 玩家出拳
\ No newline at end of file player=input("玩家请出拳:")
print("玩家出拳是:"+player)
# 电脑出拳
import random # 导入random模块
list=["剪刀","石头","布"]# 创建list列表,储存 剪刀,石头,布
computer = random.choice(list)# 设置电脑出拳 使用computer变量 和 random.choice()方法
print("电脑出拳是:"+computer) # 输出"电脑出拳是:"
if player==computer:
print("平局")
elif (player=="石头" and computer=="剪刀") or (player=="剪刀" and computer=="布") or (player=="布" 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