Commit c18b2a29 by BellCodeEditor

auto save

parent 3d0f65c7
Showing with 13 additions and 8 deletions
# 玩家出拳 # 玩家出拳
import random import random
player = input("玩家出拳:") while True:
print("玩家出的是:",player) player = input("玩家出拳:")
list1 = ['石头','剪刀','布'] print("玩家出的是:",player)
computer = random.choice(list1) list1 = ['石头','剪刀','布']
print("计算机的是:",computer) computer = random.choice(list1)
if computer == player: print("计算机的是:",computer)
if player in list1:
if computer == player:
print('平局!') print('平局!')
elif computer == "剪刀" and player == "石头" or computer == "石头" \ elif computer == "剪刀" and player == "石头" or computer == "石头" \
and player == "布" or computer == "布" and player == '剪刀': and player == "布" or computer == "布" and player == '剪刀':
print('玩家赢了') print('玩家赢了')
else: else:
print("计算机赢了!") 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