点击查看【bilibili】

    学习代码如下:

    1. """
    2. 1、出拳
    3. 玩家:手动出拳
    4. 电脑:1.固定出拳 2.随机出拳
    5. 2、判断输赢
    6. 玩家获胜
    7. 电脑获胜
    8. 平局
    9. """
    10. #玩家获胜
    11. player = int(input('请出拳:0--石头;1--剪刀;2--布'))
    12. computer = 1
    13. if ((player == 0) and (computer == 1)) or ((player == 1) and (computer == 2)) or ((player == 2) and (computer == 0)):
    14. print('恭喜玩家获胜')
    15. elif player == computer:
    16. print('打平了哟')
    17. else:
    18. print('恭喜电脑获胜')

    运行结果如下:
    image.png