- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What does immutable mean? Which Python types are mutable and which are not?
In Python, there are two types of Objects.
- Mutable Object
- Immutable Object
Mutable: Mutable objects are modified, (i.e) objects are a changeable list, set, dict, etc are mutable.
mutable objects are easy to change.
list =["Tutorials ","Point", "Pvt","Ltd"] list= 'Tutorix' list
['Tutorials ', 'Point', 'Tutorix', 'Ltd']
list=['Car','Bike','Scooty','Bus','Metro'] list= 'Bicycle' list
['Car', 'Bike', 'Scooty', 'Bus', 'Bicycle']
Immutable: immutable objects are not modified (i.e) not changeable int, float, bool, str, tuple, Unicode, etc ... are immutable. immutable objects are expensive and difficult to change. a tuple is enclosed within the parenthesis tuples are immutable and can't be changed.
('1', '2', 'Python', 'Perl')
tuple=('1','2','Python','Perl') tuple='2019' tuple
TypeError Traceback (most recent call last) in 1 tuple=('1','2','Python','Perl') ----> 2 tuple='2019' 3 tuple TypeError: 'tuple' object does not support item assignment
tuple object cant be changed by seeing above output you get a clear understanding
- Which data types are immutable in Python?
- Difference between mutable and immutable in python?
- Difference between mutable and immutable object
- What are the different types of stylish bottoms for women which I may not know of?
- What are the types of process scheduling algorithms and which algorithms lead to starvation?
- Python - Show which entries in a Pandas Index are not NA
- Which characters are NOT allowed in MongoDB field names?
- What are the symptoms of bird flu which should not be ignored?
- Which grapes are the tastiest?
- What are plagiarism tools and which is best to use?
- Find the element before which all the elements are smaller than it, and after which all are greater in Python
- How can you avoid getting an error if you are deleting a table which does not exist using Python?
- What is the difference between a mutable and immutable string in C#?
- What are the different wildcard characters which can be used with NOT LIKE operator?
- Program to remove all nodes from BST which are not in range in Python