I’m giving my first steps on Python. I saw that we don’t have switch case statement, so I would you guys implement a text Menu in python?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You might do something like this:
This puts all your possible actions’ functions into a dictionary, with the key being what you will input to run the function. It then retrieves the action input action from the list, unless the input action doesn’t exist, in which case it retrieves no_such_action.
After you have a basic understanding of how this works, if you’re considering doing a Serious Business command-line–type application, I would look at the
cmdframework for command-line applications.