If these checks are part of the same logic, you should use elif
instead of independent if
statements. And like @Sinnie said add a final else.
If you are 100% sure the game can only be in one of these states, than instead of adding an else
to the end, just replace the final elif
for an else
.
When you do this, the logic will always pick the first that matches and only the first.
CSLib has utilities for calculating the maximum number in a list. You might be interested.
I’ve posted a solution for checking the maximum value in an list before. You might be intereted:
2 Likes