Fix Python – Most efficient way of making an if-elif-elif-else statement when the else is done the most?
I’ve got a in if-elif-elif-else statement in which 99% of the time, the else statement is executed:
if something == ‘this’:
doThis()
elif something == ‘that’:
doThat()
elif something == ‘there’:
doThere()
else:
doThisMostOfTheTime()
This construct is done a lot, but since it goes over every condition before it hits the else I have….