Immutable vs mutable data types in python

RachitVerma25 999 views 7 slides Jun 21, 2021
Slide 1
Slide 1 of 7
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7

About This Presentation

This presentation is here to help you understand about the data types in Python, and it explains about type casting/type conversion, as well as Immutable vs Mutable Data Types in
Python


Slide Content

Data Types in Python
Swipe

Type Casting/Type Conversion in Python
Int(x)
int (10)
int(10.20)
int('10')
int('10.20')
int(0b1010)
int(true)
int(A)
int(true)

float(x) complex(x,y) bool() str()
float (10)
float (10.20)
float ('10')
float ('10.20')
float (0b1010)
float (true)
float (A)
float (true)

complex(10)
complex(10.20)
complex('10')
complex('10.20')
complex(0b1010)
complex(true)
complex(A)
complex(true)

bool(0)
bool(0.0)
book(0+0j)
bool('')
bool([])
bool(0)
bool(none)
bool(* *)
str(complex(10,20))
srt('python')
str('10.20')

Immutable vs Mutable Data Types in
Python
By now you may have heard the phrase “everything in
Python is an object”.
Objects are abstraction for data, and Python has an
amazing variety of data structures that you can use to
represent data, or combine them to create your own
custom data.

A first fundamental distinction that Python makes on data
is about whether or not the value of an object changes.
If the value can change, the object is called mutable, while
if the value cannot change, the object is called immutable.
( ) Vs [ ]
Immutable vs Mutable Data Types in
Python

Mutable Data Type in Python
Mutable
Data Types
List
Bytes arrays
Sets
Dictionaries
Note:-
Mutable sequences can be changed after creation. Some of
Python’s mutable data types are: lists, byte arrays, sets, and
dictionaries.

Immutable Data Type in Python
Immutable
Data Types
Numeric Data Types
Strings and Bytes
Frozen Sets
Tuples
Note:-
Immutable can not be changed after creation. Some
immutable types include numeric data types, strings, bytes,
frozen sets, and tuples.

Mutable vs Immutable Data
type in Python
Stay Tuned with
Topics for next Post