elifIntermediate Playground

Short for 'else if'; adds another condition to an if chain

Python Playground
Output
Click "Run" to execute your code

Long elif chains can often be replaced with dictionary lookups, which are cleaner and O(1) vs O(n) for the chain.

Challenge

Try modifying the code above to explore different behaviors. Can you extend the example to handle a new use case?