猜拳游戏
作者:互联网
''' 石头(1) 剪刀(2) 布(3) 电脑赢: 1-2,2-3,3-1 平局: 1-1,2-2,3-3 我赢: 1-3,2-1,3-2 ''' import random user =int(input("请输入猜拳的数字石头(1) 剪刀(2) 布(3):")) #computer是一个int类型 computer = random.randint(1,3) print(computer,"-",user) if user == computer: print("平局") elif (computer ==1 and user == 3) or (computer == 2 and user ==1) or (computer == 3 and user == 2): print("用户赢") else: print("电脑ying")
标签:猜拳,int,random,computer,user,print,平局,游戏 来源: https://blog.csdn.net/luoygyyds/article/details/123169207