Commit 395569e8 by BellCodeEditor

save project

parent 220fe62b
Showing with 22 additions and 0 deletions
#石头:1 剪刀:2 布:3
import random
a = ['石头','剪刀','布']
b = 0
#判断
while True:
print('----------开始游戏!----------')
c = random.choice(a)
#出拳
p = input('请出拳:')
print('-----------------------------')
print('玩家出拳:' + p)
print('电脑出拳:' + c)
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