control-structure

Is there a way to write these ifs nicer?

Is there a way to write these ifs nicer? Question: I need to write these four ifs in Python. Notice what it does, is changing between four possible states in a loop: 1,0 -> 0,1 -> -1,0 -> 0,-1 and back to first. if [dx, dy] == [1,0]: dx, dy = 0, 1 if [dx, …

Total answers: 5