Python小练习(2)—石头剪刀布
“”"
石头1
剪刀2
布3
电脑人—随机数
玩家
玩家赢的事件:
如果电脑出石头 你出布
如果电脑出布 你出剪刀
如果电脑剪刀 你出石头
“”"
import random
count = 0
while True:
player = int(input("请输入石头1 剪刀 2 布3 "))
count+=1
if player >= 1 and player <= 3:
computer = random.randint(1,3)
if (player == 1 and computer == 2) or (player == 2 and computer ==3)\
or (player == 3 and computer == 1):
print('玩家赢了')
break
elif player == computer:
print('平局')
else:
print('电脑赢了')
print(computer)
else:
print('你的输入是错误的')
if count == 1:
print('你好吊呀,厉害')
elif count > 1 and count <=3:
print('继续加油呀')
elif count >3 and count <= 5:
print('不行呀')
else:
print('菜鸡')