用python实现猜拳小游戏
import random
while(1):
y = random.randint(0, 2)
x = int(input()) ‘’‘一定要注意input输入的东西是str(字符串)格式的’’’
if x>=0 and x<=2:
print(‘0=石头,1=剪刀,2=布’)
print(x, y)
if x == 0 and y == 1 or x == 1 and y == 2 or x == 2 and y == 0:
print(‘you loss’)
elif x == y:
print('平局')
else:
print('you win')
else:
print('你犯规了')
continue