Selecting user commands in style (Python)
If you write an interactive program that takes user commands as an input, you can select the appropriate action for a given command by going through a sequence of
if... else ifstatements. But if you write in Python, there’s always a cooler way to do things. A method I like personally in this situation is defining a dictionary where the keys …
See archives for more ...