I refactored the main by creating a dictionary called 'actions. Each key corresponds to the user's choice in the menu and the value of the corresponding function.
When the user makes a choice, 'actions.get(choice) is used to retrieve the function associated with that choice.
I the user makes a valid choice, the function is called, otherwise,an error message is printed.
Now each action is defined in it's own function (No more 'stairway of elifs').
I refactored the main by creating a dictionary called 'actions. Each key corresponds to the user's choice in the menu and the value of the corresponding function.
When the user makes a choice, 'actions.get(choice) is used to retrieve the function associated with that choice.
I the user makes a valid choice, the function is called, otherwise,an error message is printed.
Now each action is defined in it's own function (No more 'stairway of elifs').
I welcome your feedback :)