In Python 3+, input
returns a string, and 4
does not equal '4'
. You will have to amend to:
while x != '4':
or alternatively use int
, being careful to check for a ValueError
if the input is not an int.
More Related Contents:
- Python def function return None in all cases
- Convert pandas dataframe to NumPy array
- How to make a custom activation function with only Python in Tensorflow?
- In Matplotlib, what does the argument mean in fig.add_subplot(111)?
- Does python urllib2 automatically uncompress gzip data fetched from webpage?
- How to enumerate an object’s properties in Python? [duplicate]
- Schedule Python Script – Windows 7
- Update a dataframe in pandas while iterating row by row
- How can I check if an ip is in a network in Python?
- Why do attribute references act like this with Python inheritance? [duplicate]
- Securely storing environment variables in GAE with app.yaml
- How to use python-docx to replace text in a Word document and save
- Left justify string values in a pandas DataFrame
- How to get day name from datetime
- How do I convert a string into an f-string?
- Override global variable inside function not working with Spyder 4
- Using OpenCV with Tkinter
- join or merge with overwrite in pandas
- Re.sub not working for me
- How do I find the Windows common application data folder using Python?
- How to download only the latest file from SFTP server with Paramiko?
- PyQt – how to detect and close UI if it’s already running?
- python matplotlib: plotting in another process
- Jupyter | The kernel appears to have died. It will restart automatically |
- Flask-SQLAlchemy Constructor
- tkinter optionmenu first option vanishes
- Spyder IDE Console History
- Trouble Installing Pygame on Mac OSX
- Pygame: Collision by Sides of Sprite
- How to stop one or multiple for loop(s)