[Python] Unexpected order of evaluation when using short circuit operators [closed]

Discussão em 'Python' iniciado por Stack, Setembro 29, 2024.

  1. Stack

    Stack Membro Participativo

    Running the code below

    print(print('1') or print('2') and print('3') or print('4'))


    will result in:

    1
    2
    4
    None


    I know that the priority is not > and > or, so I expected

    2
    1
    4
    None


    I don't understand that result. Please explain it.

    Continue reading...

Compartilhe esta Página