Top Ad unit 728 × 90

Libreoffice

Libreoffice Writer

Built-in Data Types in Python with Example

 


Built-in Data Types

Variables can store data of different types, and different types can do different things.


Getting the Data Type


You can get the data type of any object by using the type() function:


'int' Data Type


Python 

x = 5

print(type(x))



Output


<class 'int'>



'str' Data Type



Python 


x = "Hello World"


print(type(x)) 



Output


<class 'str'>



'float' Data Type


Python 


x = 20.5


print(type(x))



Output

<class 'float'>



'complex' Data Type



Python 


x = 1j

print(type(x)) 



Output


<class 'Complex'>


'list' Data Type


Python 


x = ["apple", "banana", "cherry"]

print(type(x)) 



Output

<class 'list'>


'tuple' Data Type


Python 

x = ("apple", "banana", "cherry")


print(type(x)) 


Output

<class 'tuple'>


'rang' Data Type


Python 


x = range(10)


print(list(x)



Output


<class 'rang'>



'dict' Data Type


Python 

x = {"name" : "John", "age" : 36}


print(type(x)) 


Output


<class 'dict'>


'set' Data Type


Python 


x = {"apple", "banana", "cherry"}


print(type(x)) 



Output


<class 'set'>



'frozenset' Data Type


Python 


x = frozenset({"apple", "banana", "cherry"})


print(type(x)) 



Output

<class 'frozenset'>


'bool' Data Type


Python 


x = True


print(type(x)) 



Output

<class 'bool'>



'byte' Data Type


Python 


x = b"Hello"


print(type(x)) 



Output

<class 'byte'>


'none' Data Type


Python 


x = none


print(type(x)) 


Output

<class 'none'>
Built-in Data Types in Python with Example Reviewed by ADcomputercampus on November 02, 2025 Rating: 5

No comments:

Contact Form

Name

Email *

Message *

Powered by Blogger.