Вместо
1 2 3 4 5 6 7 8 9 10 |
if first_condition: if second_condition: first_operator else: second_operator else: if second_condition: second_operator else: first_operator |
можно записать
1 2 3 4 |
if first_condition ^ second_condition: # ^ - оператор xor second_operator else first_operator |