I was fiddling with one line if and for statements in python and ran across the following problem:
I can make something like the following work:
state = 1 if state == 4 else 2
But I want to use = and += in the same context, something like this:
state = 1 if state == 4 else state+=1
How can I implement this in one line?
Aucun commentaire:
Enregistrer un commentaire