Commit e503810f by BellCodeEditor

save project

parent 9039dec8
Showing with 37 additions and 28 deletions
# 玩家出拳
#石头:1 剪刀:2 布:3
import random
a = ['石头','剪刀','布']
print('----------开始游戏!----------')
c = random.choice(a)
#石头:1 剪刀:2 布:3
print(c)
p = input('请出拳:')
print('玩家出拳:' + p)
if p == '石头' :
if c == '石头':
print('本轮结果:平局')
if c == '剪刀':
print('本轮结果:玩家获胜!')
if c == '布':
print('本轮结果:电脑获胜!')
if p == '剪刀' :
if c == '石头':
print('本轮结果:电脑获胜!')
if c == '剪刀':
print('本轮结果:平局')
if c == '布':
print('本轮结果:玩家获胜!')
if p == '布' :
if c == '石头':
print('本轮结果:玩家获胜!')
if c == '剪刀':
print('本轮结果:电脑获胜!')
if c == '布':
print('本轮结果:平局')
b = 0
#判断
while True:
print('----------开始游戏!----------')
c = random.choice(a)
#出拳
p = input('请出拳:')
print('-----------------------------')
print('玩家出拳:' + p)
print('电脑出拳:' + c)
if p == '石头' :
if c == '石头':
print('本轮结果:平局')
if c == '剪刀':
print('本轮结果:玩家获胜!')
b = b+1
if c == '布':
print('本轮结果:电脑获胜!')
if p == '剪刀' :
if c == '石头':
print('本轮结果:电脑获胜!')
if c == '剪刀':
print('本轮结果:平局')
if c == '布':
print('本轮结果:玩家获胜!')
b = b+1
if p == '布' :
if c == '石头':
print('本轮结果:玩家获胜!')
b = b+1
if c == '剪刀':
print('本轮结果:电脑获胜!')
if c == '布':
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