Data Types in Python Programming Language

Author: Al-mamun Sarkar Date: 2021-04-04 07:09:56

Data types indicate the type of data of a variable. Python has various built-in data types. Python built-in data types are as follows.

Numeric Data Types: intfloatcomplex
Text Data Type: str
Boolean Data Type: bool
Sequence Data  Types: listtuplerange
Mapping Data Type: dict
Set  Data Types: setfrozenset
Binary Data Types: bytesbytearraymemoryview

 

Use Different Types Variable:

message = "Hello World" # str
i = 20 # int
f = 20.5 # float
l = ["a", "b", "c"] # list
t = ("a", "b", "c") # tuple
r = range(6) # range
d = {"name" : "Jon", "roll" : 12} # dict
s = {"a", "b", "c"} # set
b = True # bool

 

Define Variables Type:

message = str("Hello World") # str
i = int(20) # int
f = float(20.5) # float
l = list(("a", "b", "c")) # list
t = tuple(("a", "b", "c")) # tuple
r = range(6) # range
d = dict("name" : "Jon", "roll" : 12) # dict
s = set(("a", "b", "c")) # set
b = bool(5) # bool