結果 : python how to avoid nested if statements