Data types in Python:


Data types: 


It defines what type of data a variable is carrying. There are 4 main data types that are frequently used is Python programming are; int, float, str, and bool.

Any whole number with no decimal places is referred to as Integer, like 1 or 20.

X = 10

print(x)

print(type (x))

10

<class’int'>


The floats are the number with decimal places like 3.14 or 5.22 

X=2.5

print(x)

print(type (x))

2.5

‹class’float’>


Any kind of non-numerical data, like letters or words, are strings. Strings can be built using single ‘ ‘ or double quotes ""


X = 'English'

print(x)

print(type (x))

English

<class‘str'>


True and False are the example of Boolean values, and can be referred to as

"Yes"and "No". Boolean values is used to do filtering operations on data.


X = True

print(x)

print(type (x))

True

‹class’bool'>

Comments