Commit c18b2a29 by BellCodeEditor

auto save

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