Datatypes in a language used to store the data in a variable.

This tutorial explains various native built-in data types supported by Python.

Python provides the following data types

DatatypeDescription
strString Text content
int, float, complexNumeric data
list,tuple,rangeSequential data storage
dictPython hashmap or dictionary
set,frozensetset data structure, does not allow duplicates
boolboolean values true or false for conditional expression
NoneTypeNot assigned with any datatype
bytes, byte array,memoryviewBinary data storage

A variable is created using data type or literal.

For example, the Number of integers can be created as given below.

number=11 or
number= int(11)

Here is an example Python data type example.

varint=11
print(type(varint))
varfloat=11.11
print(type(varfloat))

varcomplex=11j
print(type(varcomplex))

str="welcome"
print(type(str))

list = ["one", "two", "three"]
print(type(list))
tuple = ("one", "two", "three")
print(type(tuple))
rangevar = range(10);
print(type(rangevar))

employee = {"id":1,"name":"john"};
print(type(employee))
set = {"one", "two", "three"}
print(type(set))
frozenset = frozenset({"one", "two", "three"})
print(type(frozenset))
boolean = True
print(type(boolean))
bytes = b"welcome"
print(type(bytes))
bytearray = bytearray(11)
print(type(bytearray))
nonetype = None
print(type(nonetype))

Output:

<class 'int'>
<class 'float'>
<class 'complex'>
<class 'str'>
<class 'list'>
<class 'tuple'>
<class 'range'>
<class 'dict'>
<class 'set'>
<class 'frozenset'>
<class 'bool'>
<class 'bytes'>
<class 'bytearray'>
<class 'NoneType'>