Python

Python Data types

Integer:

Integer is a numeric data type. 

x=5

print(x)

Output: 5

print(type(x))

Output: <class ‘int’>

Float:

Float is a numeric data type.

y=5.5

print(y)

Output: 5.50

print(type(y))

Output: <class ‘float’>

z=1.1e2

print(z)

Output: 110.0

print(type(z))

Output: <class ‘float’>

 

Complex number:

 Complex number is a numeric data type.

p=2+3j

print(p)

Output: 2+3j

print(type(p))

Output: <class ‘complex’>

String:

single quote, double quote or triple quote can be used

print(‘string test’)

Output: string test

To print apostrophe in the string use double quotes

print(“Python’s string data type”)

Output: Python’s string data type

To print double quotes in the string use triple quotes

print(”’He said that “Python is the trend now””’)

Output: He said that “Python is the trend now”

Boolean:

print(1==2)

Output:

false