【python简单应用】猜拳
程序员文章站
2022-07-12 21:11:46
...
#猜拳游戏
import random
player = int(input('请输入:剪刀(0) 石头(1) 布(2):'))
computer = random.randint(0,2)
if((player == 0) and (computer==2)) or ((player == 1) and (computer==0)) or ((player == 2) and (computer==1)):
print('you win!')
elif player == computer:
print('pingju')
else:
print('you lose')
上一篇: (二)PYTHON简单应用
下一篇: python实战简单应用