The while
bit could be refactored a little to make it a little bit cleaner by checking if the element is within a list of choices like so
while choice not in [1, 2, 3]:
This is checking if the value of choice is not an element in that list
More Related Contents:
- Checking if type == list in python [duplicate]
- How to iterate over columns of pandas dataframe to run regression
- How to do a scatter plot with empty circles in Python?
- How to save & load xgboost model? [closed]
- Mapping dictionary value to list
- Using Python to execute a command on every file in a folder
- How can I host my own private conda repository?
- python function default parameter is evaluated only once? [duplicate]
- Airflow “This DAG isnt available in the webserver DagBag object “
- Overwrite previous output in jupyter notebook
- Load CSV to Pandas MultiIndex DataFrame
- Can I use the variable name “type” as function argument in Python?
- Python Global Interpreter Lock (GIL) workaround on multi-core systems using taskset on Linux?
- Capture makes remaining patterns unreachable
- Python pandas – new column’s value if the item is in the list
- Adding folder to Python’s path permanently
- How to run a python script at a specific time(s)
- pdfminer – ImportError: No module named pdfminer.pdfdocument
- Selenium python: Can not connect to the Service %s” % self.path
- reload module with pyximport?
- What is the difference between .py and .pyc files? [duplicate]
- Decorator error: NoneType object is not callable
- When should I use root.update() in tkInter for python
- Python long filename support broken in Windows
- How to change variables fed into a for loop in list form
- Digitizing an analog signal
- “BadZipFile: File is not a zip file” – Error popped up all of a sudden
- calculate distance of 2 list of points in numpy
- list extend() to index, inserting list elements not only to the end
- functools.partial wants to use a positional argument as a keyword argument