- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- 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?
- Name mutable and immutable objects in Python
- Difference between mutable and immutable object
- What is the difference between a mutable and immutable string in C#?
- What are the different types of stylish bottoms for women which I may not know of?
- What are the factors on which the time period of a simple pendulum does not depend?
- 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
- How can you avoid getting an error if you are deleting a table which does not exist using Python?
- Check which of the following are solutions of the equations $2x -y =6$ and which are not.$(3, 0)$
- Check which of the following are solutions of the equations $2x -y =6$ and which are not.$(0, 6)$
- Check which of the following are solutions of the equations $2x -y =6$ and which are not.$(2,-2)$
- Check which of the following are solutions of the equations $2x -y =6$ and which are not.$(sqrt3, 0)$
- What are compound data types and data structures in Python?