Data Types

Data type specifies the type of value a variable requires to do various operations without causing an error. By default, python provides the following built-in data types:

Numeric data: int, float, complex

int: 3, -8, 0

float: 7.349, -9.0, 0.0000001

complex: 6 + 2i

more on numeric data types in the number chapter.

Text data: str

str: “Hello World!!!”, “Python Programming”

Example:

a=3.55
b=768
c="helnwl697"
print(type(a))  # float
print(type(b))   # int
print(type(c))   # string
None:

None is used to define a null value. When we assign a None value to a variable, we are essentially resetting it to its original empty state which is not the same as zero, an empty string or a False value.

Boolean data:

Boolean data consists of values True or False.

a=True
b=False
c=None
print(a,b,c)