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 datatypes

Datatype Description
str String Text content
int,float,complex Numeric data
list,tuple,range Sequential data storage
dict Python hashmap or dictionary
set,frozenset set datastructure, does not allow duplicates
bool boolean values true or false for conditional expression
NoneType Not assigned with anydatatype
bytes,bytearray,memoryview Binary data storage

A variable creates using data type or literal.

For example, Numbers 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'>