This is a premium lesson. You can see the shape of every card — unlock to read them.
Unlock
IMMUTABILITY IN PYTHON Immutability என்பது Python-ல் மிகவும் முக்கியமான concept. குறிப……
Premium
This card is part of the premium lesson.
Unlock
Immutability என்பது ஒரு object உருவாக்கப்பட்ட பிறகு அதன் original value-ஐ அதே object-ல் மாற்ற முடியாத தன்மை. ……
Premium
This card is part of the premium lesson.
Unlock
Example
name = "Python" இங்கே "Python" ஒரு String object. அ……
Premium
This card is part of the premium lesson.
Unlock
இந்த இரண்டு words-ஐ முதலில் புரிந்துகொள்ள வேண்டும். Mutab……
Premium
This card is part of the premium lesson.
Unlock
Example
List is mutable. a = [10, 20,……
Premium
This card is part of the premium lesson.
Unlock
Original list change ஆனது. ஆனால் String:……
Premium
This card is part of the premium lesson.
Unlock
Core concept
Immutability என்பதை புரிந்துகொள்ள ஒரு மு……
Premium
This card is part of the premium lesson.
Unlock
Example
இதைப் பார்த்து: Integer mutable என்று நினைக்கக்கூடாது. இங்கே 10 object change ஆகவில்லை. x என்ற variable வேறு ……
Premium
This card is part of the premium lesson.
Unlock
Object and variable
Python-ல் variable என்பது value வைத்திருக்கும் traditio……
Premium
This card is part of the premium lesson.
Unlock
Example
இதில்
x -> 100 இப்போது: x = 200 என்றால்: x -> 200……
Premium
This card is part of the premium lesson.
Unlock
Immutability flow: Object Created | v Value Stored | v Modific……
Premium
This card is part of the premium lesson.
Unlock
Immutable data types in python
Python-ல் commonly immutable data types: int float complex bool……
Premium
This card is part of the premium lesson.
Unlock
Mutable data types
Common mutable types: list dict s……
Premium
This card is part of the premium lesson.
Unlock
List mutable என்பதால் origina……
Premium
This card is part of the premium lesson.
Unlock
String immutability
Python String immutable. text……
Premium
This card is part of the premium lesson.
Unlock
Why string cannot be modified
String: text = "Python" Characters: P y t h o n 0 1 2 3 4 5 நாம்: text[0] = "J" என்று எழுதினால் Pyth……
Premium
This card is part of the premium lesson.
Unlock
How to change an immutable string
String-ஐ direct modify செய்ய முடியாது. ஆனா……
Premium
This card is part of the premium lesson.
Unlock
இங்கே original "Python" objec……
Premium
This card is part of the premium lesson.
Unlock
text = "Python" text "Python" string object-ஐ reference செய்கிறது. text[1:] Out……
Premium
This card is part of the premium lesson.
Unlock
Important difference
இந்த இரண்டு statements ஒன்றல்ல. text[0] = "J" மற்றும்: text = "Java" First: Exis……
Premium
This card is part of the premium lesson.
Unlock
Program 1
Premium
This card is part of the premium lesson.
Unlock
Premium
This card is part of the premium lesson.
Unlock
இதைப் பார்த்து String mutable என்று நினைக்கக்கூடாது. இங்கே……
Premium
This card is part of the premium lesson.
Unlock
Memory view
Conceptually: Before: name | v "Python" After: ……
Premium
This card is part of the premium lesson.
Unlock
Integer immutability
Premium
This card is part of the premium lesson.
Unlock
Example
இங்கே
10 object-ஐ 11 ஆக modify செய்யவில்லை. Calculation: 10 + ……
Premium
This card is part of the premium lesson.
Unlock
Using id function
Python-ல் object identity பார……
Premium
This card is part of the premium lesson.
Unlock
Example
Conceptually two different object identitie……
Premium
This card is part of the premium lesson.
Unlock
Exact id() values system/run-……
Premium
This card is part of the premium lesson.
Unlock
String id example
text = "Python" print(id(text)) text = text + " Programming" print(id(t……
Premium
This card is part of the premium lesson.
Unlock
Example
Premium
This card is part of the premium lesson.
Unlock
Question
Original String modified ஆகிறதா? Answer: No. New……
Premium
This card is part of the premium lesson.
Unlock
String methods and immutability
String methods கூட original Str……
Premium
This card is part of the premium lesson.
Unlock
ஏன்? upper() new String return செய்கிறது.……
Premium
This card is part of the premium lesson.
Unlock
Dry Run
text = "python" text.upper()
Example
text = "Python" text.replace(……
Premium
This card is part of the premium lesson.
Unlock
replace() original String-ஐ m……
Premium
This card is part of the premium lesson.
Unlock
String methods return new objects
String immutable என்பதால் இந்த methods பொதுவாக புதிய String return ……
Premium
This card is part of the premium lesson.
Unlock
Tuple immutability
Tuple immutable. numbers = (1……
Premium
This card is part of the premium lesson.
Unlock
Error
TypeError: 'tuple' object does not support it……
Premium
This card is part of the premium lesson.
Unlock
Comparison
Tuple vs list
List: numbers = [10, 20, 30] numbers[0] = 100 Allowed. Tuple:……
Premium
This card is part of the premium lesson.
Unlock
Important tuple concept
Tuple immutable என்றாலும் tup……
Premium
This card is part of the premium lesson.
Unlock
Example
data = ([10, 20], 30) இங்கே outer object: Tuple Im……
Premium
This card is part of the premium lesson.
Unlock
இது மிகவும் முக்கியமான advanc……
Premium
This card is part of the premium lesson.
Unlock
Why above tuple changed
Actually tuple structure change ஆகவில்லை. Tuple still contains: first element -> same list ……
Premium
This card is part of the premium lesson.
Unlock
Not allowed
data = ([10, 20], 30) data[0] = [100, 200] Error வரும……
Premium
This card is part of the premium lesson.
Unlock
Allowed
data = ([10, 20], 30) data[0]……
Premium
This card is part of the premium lesson.
Unlock
Outer tuple immutable. Inner ……
Premium
This card is part of the premium lesson.
Unlock
Comparison
Mutability vs reassignment
இந்த concept exam-ல் மிகவும் முக்கியம். Mutation: Existing object-ஐ change செய்வது. Reassignment: Variable எந……
Premium
This card is part of the premium lesson.
Unlock
Mutable list example
a = [1, 2, 3] b = a a.append(……
Premium
This card is part of the premium lesson.
Unlock
Why? a மற்றும் b same List ob……
Premium
This card is part of the premium lesson.
Unlock
Reference flow
a -------| | v [1, 2, 3] ^ | b -------| a.append(4) ச……
Premium
This card is part of the premium lesson.
Unlock
Immutable string reference
a = "Python" b = a a = "Java"……
Premium
This card is part of the premium lesson.
Unlock
Initially: a ----| v "Python" ^ | b ----| பிறகு: a ……
Premium
This card is part of the premium lesson.
Unlock
Function and immutability
Immutable objects function-க்கு pass ……
Premium
This card is part of the premium lesson.
Unlock
Example
Premium
This card is part of the premium lesson.
Unlock
Why? x = x + 10 மூலம் function-க்குள் x புதிய integer o……
Premium
This card is part of the premium lesson.
Unlock
Mutable function example
def change(values): values.append(4……
Premium
This card is part of the premium lesson.
Unlock
List mutable என்பதால் functio……
Premium
This card is part of the premium lesson.
Unlock
Comparison
Comparison in functions
Hashability connection
Immutability மற்றும் Hashability இரண்டு related concepts. Hashable object என்றால் அதன் hash value s……
Premium
This card is part of the premium lesson.
Unlock
Example
String and Integer keys valid.…
Premium
This card is part of the premium lesson.
Unlock
List cannot be dictionary key
data = { [1, 2]: "value" }…
Premium
This card is part of the premium lesson.
Unlock
Error
TypeError: unhashable type: 'list' L……
Premium
This card is part of the premium lesson.
Unlock
Tuple as dictionary key
Tuple-ல் உள்ள எல்லா items-மும……
Premium
This card is part of the premium lesson.
Unlock
Example
Important exception
All immutable objects are has……
Premium
This card is part of the premium lesson.
Unlock
Example
x = ([1, 2], 3) இந்த tuple itself immutable structure கொண்டது.……
Premium
This card is part of the premium lesson.
Unlock
Frozenset
Premium
This card is part of the premium lesson.
Unlock
Example
Premium
This card is part of the premium lesson.
Unlock
frozenset immutable version o……
Premium
This card is part of the premium lesson.
Unlock
Example
இதற்கு: a.add(4) செய்ய முடியா……
Premium
This card is part of the premium lesson.
Unlock
Bytes and bytearray
bytes immutable. bytearray mu……
Premium
This card is part of the premium lesson.
Unlock
Example
bytes items direct-a modify ச……
Premium
This card is part of the premium lesson.
Unlock
Why immutability is useful
Immutability Python-ல் பல adv……
Premium
This card is part of the premium lesson.
Unlock
Premium
This card is part of the premium lesson.
Unlock
ஒரு object accidentally modif……
Premium
This card is part of the premium lesson.
Unlock
1. Predictable Behaviour…
Premium
This card is part of the premium lesson.
Unlock
Value unexpectedly change ஆகா……
Premium
This card is part of the premium lesson.
Unlock
Premium
This card is part of the premium lesson.
Unlock
Immutable values dictionary k……
Premium
This card is part of the premium lesson.
Unlock
Premium
This card is part of the premium lesson.
Unlock
Same immutable object பல refe……
Premium
This card is part of the premium lesson.
Unlock
Premium
This card is part of the premium lesson.
Unlock
Value mutation குறைவாக இருப்பத……
Premium
This card is part of the premium lesson.
Unlock
String slicing and immutability
String slicing original strin……
Premium
This card is part of the premium lesson.
Unlock
Actually Python case-sensitive ஆக இருப்பதால் ……
Premium
This card is part of the premium lesson.
Unlock
Uppercase example
text = "python" result = text……
Premium
This card is part of the premium lesson.
Unlock
இதுதான் String immutability-க……
Premium
This card is part of the premium lesson.
Unlock
Common confusion 1
x = "Hello" x += " World"…
Premium
This card is part of the premium lesson.
Unlock
Question
+= original String-ஐ modify செய்கிறதா? No. Strings immutable. இ……
Premium
This card is part of the premium lesson.
Unlock
Common confusion 2
x = 10 x += 5 இதுவும் 10 object-ஐ modify……
Premium
This card is part of the premium lesson.
Unlock
Common confusion 3
Tuple immutable என்றால் அதன் உள்ளே எதையும் change செய்ய முடியாது என்பது completely correct அல்ல. Tuple ……
Premium
This card is part of the premium lesson.
Unlock
Error 1
text = "Python" text[0] = "J"…
Premium
This card is part of the premium lesson.
Unlock
Error
TypeError Reason: String immu……
Premium
This card is part of the premium lesson.
Unlock
Error 2
t = (10, 20, 30) t[1] = 100…
Premium
This card is part of the premium lesson.
Unlock
Error
TypeError Reason: Tuple immut……
Premium
This card is part of the premium lesson.
Unlock
Error 3
number = 10 number[0] = 20 Int……
Premium
This card is part of the premium lesson.
Unlock
Comparison
Mutable vs immutable complete comparison
Comparison
Identity vs value
Python-ல் இரண்டு different concepts: V……
Premium
This card is part of the premium lesson.
Unlock
Example
a = "Python" b = "Python"…
Premium
This card is part of the premium lesson.
Unlock
இதன் meaning: Both have equal values. is என்பது same object identity-ஐ test செய்கிறது. ……
Premium
This card is part of the premium lesson.
Unlock
Example
Object creation concept
Immutable object-ல் ஒரு operation res……
Premium
This card is part of the premium lesson.
Unlock
Example
Flow: x -> 10 10 + 5 | v 15 y……
Premium
This card is part of the premium lesson.
Unlock
Mutation example
x = [10, 20] x.append(30) Flow: Before: x -> [10, ……
Premium
This card is part of the premium lesson.
Unlock
Reassignment example
x = [10, 20] x = [100, 200] இங்கே old list modify ஆகவில்லை. Variable n……
Premium
This card is part of the premium lesson.
Unlock
Which of the following is imm……
Premium
This card is part of the premium lesson.
Unlock
TRB, NET, SET exams-க்கு remember: String = Immutable Tuple = Immutable Integer = Immu……
Premium
This card is part of the premium lesson.
Unlock
Question
What does immutable mean in Python? Answer: An immutable object is an object whose value or inter……
Premium
This card is part of the premium lesson.
Unlock
Question
If String is immutable, how can this work? x = "Python" x = "Ja……
Premium
This card is part of the premium lesson.
Unlock
Question
Why are immutable objects useful as dictionary keys? Answer: Dictionary keys depend on a sta……
Premium
This card is part of the premium lesson.
Unlock
Which Python data type is mut……
Premium
This card is part of the premium lesson.
Unlock
What happens? s = "Python" s[……
Premium
This card is part of the premium lesson.
Unlock
Premium
This card is part of the premium lesson.
Unlock
What is the output? s = "pyth……
Premium
This card is part of the premium lesson.
Unlock
Mcq 5
What is the output? s = "pyth……
Premium
This card is part of the premium lesson.
Unlock
Which statement is correct?…
Premium
This card is part of the premium lesson.
Unlock
Which data type is mutable?…
Premium
This card is part of the premium lesson.
Unlock
Mcq 8
What happens? t = (1, 2, 3) t[1……
Premium
This card is part of the premium lesson.
Unlock
Mcq 9
What is the output? a = "Hell……
Premium
This card is part of the premium lesson.
Unlock
Which is the immutable versio……
Premium
This card is part of the premium lesson.
Unlock
Practice
Practice 1
Predict: text = "Computer" text.replace("C", "K……
Premium
This card is part of the premium lesson.
Unlock
Practice
Practice 2
Predict: text = "Computer" text =……
Premium
This card is part of the premium lesson.
Unlock
Practice
Practice 3
Predict: a = [1, 2] b = a a.append(3) print……
Premium
This card is part of the premium lesson.
Unlock
Practice
Practice 4
Predict: a = "Hi" b = a a = a……
Premium
This card is part of the premium lesson.
Unlock
Reason: A new String is created fo……
Premium
This card is part of the premium lesson.
Unlock
Mutable = Modify same object Immutable = Cannot modify sam……
Premium
This card is part of the premium lesson.
Unlock
Very important concept
Do not say: "Immutable variable cannot change." Correct statement: "Immutable object can……
Premium
This card is part of the premium lesson.
Unlock
Question
x = "Python" x += "3" print(x)…
Premium
This card is part of the premium lesson.
Unlock
Does this prove String is mut……
Premium
This card is part of the premium lesson.
Unlock
A new String "Python3" is cre……
Premium
This card is part of the premium lesson.
Unlock
Advanced point
Immutability is about an object's observable state. For built-in immutable types like: int str tuple ……
Premium
This card is part of the premium lesson.
Unlock
Complete concept map
Python Objects | +--------------------+ | | Mutable Immutable ……
Premium
This card is part of the premium lesson.
Unlock
Immutability என்பது: ஒரு object create செய்யப்பட்ட பிறகு அதன் value அல்லது internal state-ஐ direct-a modify ச……
Premium
This card is part of the premium lesson.
Unlock
Short description
Immutability means that once an object is created, its value cannot be changed directly. In Python, String, T……
Premium
This card is part of the premium lesson.
Unlock