I would like to know if I have if-else or if-elif-elif-....-else condition like below:
if conditionA:
do A
elif conditionB:
do B
elif conditionC:
do C
...
...
...
else:
do z
Q1. If I already know that my condition resolve in conditionC
for 99% of time, putting that condition as first one (instead of conditionA
) would make my code more efficient?
Q2. Similarly, should I prioritize my statements that way, if Q1 is true?
Apologies if the question has already been asked. I might not have found the proper vocabulary to search for this.
Thank You.