Commit 1d5af79a by BellCodeEditor

auto save

parent b5c6bbbe
Showing with 61 additions and 0 deletions
import random
i = 0
while i < 10:
playerStr = input("请输入[0剪刀 1石头 2布]")
player = int(playerStr)
mac = random.randint(0, 2)
if (player == 0 and mac == 2) or (player == 1 and mac == 0) or (player == 2 and mac == 1):
print("你赢了")
elif player == mac:
print("平局,要不要再来一句")
else:
print("你输了")
i = 1
import random
tj = {'胜': 0, '负': 0, '平': 0, '次数': 0}
quanList=['剪刀','石头','布']
def myGame():
while True:
myQuan=input("请出拳:\n")
computerQuan=random.choice(quanList)
if myQuan=='exit':
print('下次再来玩!')
print('胜:%s 负:%s 平:%s 次数:%s'%(tj['胜'],tj['负'],tj['平'],tj['次数']))
tj['胜']=0
tj['负'] = 0
tj['平'] = 0
tj['次数'] = 0
break
elif myQuan not in quanList:
print('错误的值')
continue
elif myQuan==random.choice(quanList):
print('打平')
tj['平'] +=1
tj['次数'] += 1
continue
elif (myQuan==quanList[0] and computerQuan==quanList[2]) or (myQuan==quanList[1] and computerQuan==quanList[0]) or(myQuan==quanList[2] and computerQuan==quanList[2]):
print('赢了!')
tj['胜'] +=1
tj['次数'] += 1
continue
else:
print('你输了!')
tj['负'] += 1
tj['次数'] += 1
continue
myGame()
\ No newline at end of file
a=input("输入")
a=int(a)
if a==10:
print("等于")
elif:
if a < 10:
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