mardi 22 juin 2021

SyntaxError: invalid syntax — if statement inside if statement in a singe line

I can do smth like:

if maxoksum > 0: R = maxoksum

But if I try very similar thing like:

if oksum % 3 == 0: if oksum > maxoksum: maxoksum = oksum

I get SyntaxError:

    if oksum % 3 == 0: if oksum > maxoksum: maxoksum = oksum
                        ^
SyntaxError: invalid syntax

What am I doing wrong? Is there any way to get working if inside if in one line?

Aucun commentaire:

Enregistrer un commentaire