Write
response = input('Would like to …?').lower()
if response == 'y' or response == 'yes':
…
Or
if response in ['y', 'yes']:
…
Note that it’s not necessary to call str
— your object is already a string.
More Related Contents:
- Python math.exp function Syntax
- How can I concatenate str and int objects?
- What does “SyntaxError: Missing parentheses in call to ‘print'” mean in Python?
- Pandas groupby with delimiter join
- Changes in import statement python3
- __getattr__ on a module
- Rolling window for 1D arrays in Numpy?
- Why is Tkinter Entry’s get function returning nothing?
- How to plot multiple Seaborn Jointplot in Subplot
- Django – Login with Email
- Want to find contours -> ValueError: not enough values to unpack (expected 3, got 2), this appears
- TypeError: can’t use a string pattern on a bytes-like object in re.findall()
- Which tkinter modules were renamed in Python 3?
- How to specify python version used to create Virtual Environment?
- Search for a value in a nested dictionary python
- Python – Request being blocked by Cloudflare
- How do order of operations go on Python?
- How can I add python to cmd in windows [closed]
- How to make function decorators and chain them together in Python?
- How can I limit the user input to only integers in Python
- Extract a subset of key-value pairs from dictionary?
- Bare asterisk in function parameters?
- PyQt4 to PyQt5 -> mainFrame() deprecated, need fix to load web pages
- create an image with border of certain width in python
- How to reverse a dictionary (whose values are lists) in Python? [duplicate]
- Sound generation / synthesis with python?
- How to force Sphinx to use Python 3.x interpreter
- exec() not working inside function python3.x
- How to fix ipykernel_launcher.py: error: unrecognized arguments in jupyter?
- How to combine Celery with asyncio?