4-Python Data Types, Declaring and Using Numeric Data Types - Int, Float, Complex and String-01-03-2023
4-Python Data Types, Declaring and Using Numeric Data Types - Int, Float, Complex and String-01-03-2023
•
•
•
•
•
•
• mutable objects by changing the element the id() value will not
change , whereas for immutable objects id() value will change.
Immutable objects:
int, float, complex, string, tuple, frozen set
[note: immutable version of set], bytes
•Integer
•Float
•Complex
•String
>>> a = 5
>>> type(a)
<class 'int'>
>>> c = 6.2
>>> type(c)
<class 'float'>
>>> d = -0.03
>>> type(d)
<class 'float'>
>>> Na = 6.02e23
>>> Na
6.02e+23
>>> type(Na)
<class 'float'>
>>> comp = 4 + 2j
>>> type(comp)
<class 'complex'>