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: | int , float , complex |
Text Data Type: | str |
Boolean Data Type: | bool |
Sequence Data Types: | list , tuple , range |
Mapping Data Type: | dict |
Set Data Types: | set , frozenset |
Binary Data Types: | bytes , bytearray , memoryview |
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
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