x = input() y = 1 print (x) while 1 == y: if x == 1: y == y + 1 elif x % 2 == 0: #even x = x // 2 print (x) else: x = 3 * x + 1 print (x)
If you know what the Collatz conjecture is, I’m trying to make a calculator for that. I want to have x as my input so I don’t have to change x’s number and save every time I want to try out a new number.
I get below error
TypeError: not all arguments converted during string formatting’ at line 7.
Please help a noobie out.
Related Posts:
- Convert bytes to a string
- How can I represent an ‘Enum’ in Python?
- Python3 – ModuleNotFoundError: No module named ‘numpy’
- Relative imports – ModuleNotFoundError: No module named x
- How do I upgrade the Python installation in Windows 10?
- How to overcome TypeError: unhashable type: ‘list’
- TypeError: ‘builtin_function_or_method’ object is not subscriptable
- How do I use raw_input in Python 3
- Python Variable Declaration
- Relative imports in Python 3
- Pip freeze vs. pip list
- TypeError: not all arguments converted during string formatting python
- TypeError: ‘_io.TextIOWrapper’ object is not subscriptable
- How to read the last line of a file in Python?
- TypeError: module.__init__() takes at most 2 arguments (3 given)
- Python cant convert ‘list’ object to str error [closed]
- How to use filter, map, and reduce in Python 3
- numpy array: IndexError: too many indices for array
- How do I specify new lines on Python, when writing on files?
- bash: pip: command not found
- How do I check what version of Python is running my script?
- How to uninstall a package installed with pip install –user
- Converting integer to string in Python
- Reverse a string in Python
- Python for-in loop preceded by a variable
- What does if __name__ == “__main__”: do?
- How to measure elapsed time in Python?
- How to uninstall Anaconda completely from macOS
- Python: Start and stop timer [duplicate]
- How do I install opencv using pip?
- How do I compare two strings in python?
- Curve curvature in numpy
- ImportError: No module named sklearn.cross_validation
- How can I prevent the TypeError: list indices must be integers, not tuple when copying a python list to a numpy array?
- What are data classes and how are they different from common classes?
- Tensorflow import error: No module named ‘tensorflow’
- Python random function
- Converting NumPy array into Python List structure?
- ImportError: No module named matplotlib.pyplot
- How do you get the logical xor of two variables in Python?
- working of \n in python [duplicate]
- ValueError: could not convert string to float: id
- Best way to convert string to bytes in Python 3?
- The difference between comparison to np.nan and isnull()
- Should I put #! (shebang) in Python scripts, and what form should it take?
- Updating a dictionary in python
- I keep getting this error for my simple python program: “TypeError: ‘float’ object cannot be interpreted as an integer”
- Can’t fix “zipimport.ZipImportError: can’t decompress data; zlib not available” when I type in “python3.6 get-pip.py”
- ‘method’ object is not subscriptable. Don’t know what’s wrong
- NameError: global name ‘xrange’ is not defined in Python 3
- What does “SyntaxError: Missing parentheses in call to ‘print'” mean in Python?
- TypeError: Missing 1 required positional argument: ‘self’
- What is __pycache__?
- What is __pycache__?
- How to install pip3 on Windows?
- Python Setup Disabling Path Length Limit Pros and Cons?
- Type error: cannot convert the series to
- What is the purpose of “pip install –user …”?
- How to remove punctuation marks from a string in Python 3.x using .translate()?
- Subplot for seaborn boxplot
- Infinite integer in Python
- Why Python 3.6.1 throws AttributeError: module ‘enum’ has no attribute ‘IntFlag’?
- installing urllib in Python3.6
- What is sys.maxint in Python 3?
- Python: can’t assign to literal
- “Initializing” variables in python?
- Difference between except: and except Exception as e:
- Python TypeError must be str not int
- “Unicode Error “unicodeescape” codec can’t decode bytes… Cannot open text files in Python 3
- How to downgrade python from 3.7 to 3.6
- How to return dictionary keys as a list in Python?
- How to save a dictionary to a file?
- TypeError: ‘int’ object does not support item assignment
- TypeError: ‘int’ object does not support item assignment
- Youtube_dl : ERROR : YouTube said: Unable to extract video data
- Using Look Up Tables in Python
- Python3 Error: TypeError: Can’t convert ‘bytes’ object to str implicitly
- ImportError: No module named ‘cv2’ Python3
- urllib2.HTTPError: HTTP Error 403: Forbidden
- Django Rest Framework — no module named rest_framework
- Unsupported operation :not writeable python
- Object of type ‘map’ has no len() in Python 3
- how to exit a python script in an if statement
- Not able to pip install pickle in python 3.6
- Decode Hex String in Python 3
- built-in range or numpy.arange: which is more efficient?
- Printing subscript in python
- How to clear Tkinter Canvas?
- TypeError: ‘range’ object does not support item assignment
- How to install pip for Python 3 on Mac OS X?
- dump() missing 1 required positional argument: ‘fp’ in python json
- Meaning of list[-1] in Python
- Tkinter error: Couldn’t recognize data in image file
- How to install Openpyxl with pip
- Generate a random letter in Python
- What’s the correct way to convert bytes to a hex string in Python 3?
- During handling of the above exception, another exception occurred
- ‘module’ has no attribute ‘urlencode’
- How to install PyQt4 on Windows using pip?
- How to install PyQt4 on Windows using pip?