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

Immutable vs mutable data types in python

  • 1.
    Data Types inPython Swipe
  • 2.
    Type Casting/Type Conversionin 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')
  • 3.
    Immutable vs MutableData 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.
  • 4.
    A first fundamentaldistinction 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
  • 5.
    Mutable Data Typein 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.
  • 6.
    Immutable Data Typein 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.
  • 7.
    Mutable vs ImmutableData type in Python Stay Tuned with Topics for next Post