''' 石头(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")
猜拳游戏
最新推荐文章于 2024-08-30 12:42:13 发布