Utilizor
Contact Us

Python Data Types

Built-in data types.

Examples

Getting Data Type

Using the type() function.

x = 5
print(type(x))

Setting Data Type

Examples of different types.

x = "Hello World"  # str
x = 20             # int
x = 20.5           # float
x = ["apple", "banana", "cherry"]  # list
x = ("apple", "banana", "cherry")  # tuple
x = {"name" : "John", "age" : 36}  # dict

Test Your Knowledge

Python Quiz

No quiz available for this topic yet.