Commit 094a1c6b by BellCodeEditor

save project

parent b5c6bbbe
Showing with 25 additions and 0 deletions
import random
a = ['石头','剪刀','布']
b = 0
#判断
while True:
print('----------开始游戏!----------')
c = random.choice(a)
#出拳
p = input('请出拳:')
print('-----------------------------')
print('玩家出拳:' + p)
print('电脑出拳:' + c)
if not(p == '石头' or p == '剪刀' or p == '布'):
print('你输入的内容不在所选范围内!')
else:
if (p == '石头' and c == '剪刀') or (p == '剪刀' and c == '布') or (p == '布' and c == '石头'):
print('本轮结果:玩家获胜!')
b = b+1
elif (p == '石头' and c == '布') or (p == '剪刀' or c == '石头') or (p == '布' and c == '剪刀'):
print('本轮结果:电脑获胜!')
else:
print('本轮结果:平局')
print('你目前赢了:' + str(b))
\ 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