Data Types

 Data Types in Python.

Python data types:

  • None Type:   None
  • String data types: str.
  • Numeric data types: int, float, complex.
  • Binary types: bytes, bytearray, memory view
  • Boolean type: bool
  • Sequence types: list, tuple, range.
  • Mapping data type: dict.
  • Set data types: set, frozenset.

We can use type() function to verify data type used.






Data used in python can be categorized as.

  • Public, private, or protected data
  • Primitive or non-primitive
  • Mutable or immutable data types:
  • Sequence (sting, list, tuple), Boolean (True, False), dictionary, number (int, float, complex)


Data TypeExampleSequentialNumericY=PrimitiveY=Mutable

N=Non-Primitive

N=immutable

String

"Hello"

Y

 

Y

N

List

[“apple”,1, “red”]

Y

 

N

Y

Tuple

(1, “Goa”,5,6)

Y

 

N

N

Integer

123

 

Y

Y

N

Float

2.5

 

Y

Y

N

Complex

 

 

Y

 

 

Boolean

 

 

 

Y

N

Dictionary

{Key: Value}

 

 

N

Y

Set

{“apple”, “orange”}

 

 

N

Y


Comments

Popular posts from this blog

Computer Programming Brief History.

Loop: for & range

How to install Deepseek R1 local machine.