Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
4 cs xii_python_functions _ properties of data object
1. .
Class-XII Computer Science (083)
All the contents used as part of the slides are either self created or from the public domain or textbooks for Class XII.
This presentation is only used for leaning purpose only. Programs used in this presentation are based on Python 3.8.0.
Computational Thinking and Programming - 2
Working with Functions
Mutable/ immutable properties of data objects
S K Mahto, PGT (Computer Science)
J.N.V East Medinipur WB
2. Working with Functions
Mutable/ immutable properties of data objects
● Everything in Python is an object, and every objects in Python can be
either mutable or immutable.
● Since everything in Python is an Object, every variable holds an
object instance.
● When an object is initiated, it is assigned a unique object id.
Presented by : S K Mahto, PGT Computer Science
3. Working with Functions
Mutable/ immutable properties of data objects
● Its type is defined at runtime and once set can never change,
however its state can be changed if it is mutable.
● Means a mutable object can be changed after it is created, and an
immutable object can’t.
● Mutable objects: list, dict, set, byte array
● Immutable objects: int, float, complex, string, tuple, frozen set ,bytes
Presented by : S K Mahto, PGT Computer Science
4. Working with Functions
Mutable/ immutable properties of data objects
● How objects are passed to Functions
Presented by : S K Mahto, PGT Computer Science
In this function list1 an object
is being passed and its contents
are changing because it is
mutable that’s why it is
behaving like pass by reference
5. Working with Functions
Mutable/ immutable properties of data objects
● How objects are passed to Functions
Presented by : S K Mahto, PGT Computer Science
In this function value of variable b is not
being changed because it is immutable
that’s why it is behaving like pass by value