Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

are tuples mutable

# Trying to change their values results in an error.
tup = (10, "20", 20, 30, "Thirty-five", 50)
tup[0] = 1# Trying to change the first value of the tuple to 1. This raises an error.
# Tuple object does not support assigment.
Comment

are tuples in python mutable

>>> dum = ('1861-10-23', ['poetry', 'pretend-fight'])
>>> dee = ('1861-10-23', ['poetry', 'pretend-fight'])
>>> dum == dee
True
>>> dum is dee
False
>>> id(dum), id(dee)
(4313018120, 4312991048)
Comment

PREVIOUS NEXT
Code Example
Python :: python catch int conversion error 
Python :: NumPy roll Example 
Python :: change every element of list python with map 
Python :: how to find a specific word in a list python 
Python :: Tree: Postorder Traversal 
Python :: uninstall python ubuntu 18.04 
Python :: how to define a functio in python 
Python :: python ide 
Python :: automl classification tutorial sklearn 
Python :: dataclass in python 
Python :: exception handling in tkinter 
Python :: return foreignkey attribute django rest 
Python :: np.random.choice 
Python :: pandas replace word begins with contains 
Python :: calendar library in python 
Python :: how to get csv file first row first column value in python 
Python :: iterate last day of months python 
Python :: how to use for in python 
Python :: df mask 
Python :: ValueError: only one element tensors can be converted to Python scalars 
Python :: django custom user model 
Python :: flask multuple parameters 
Python :: django venv activate 
Python :: create tuples in pandas 
Python :: python hash timestamp 
Python :: get date only from datetimefiel django 
Python :: python separate strings into characters 
Python :: swapping upper case and lower case string python 
Python :: Python List clear() 
Python :: convert tuple to int 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =