欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

【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