Skip to main content

Python: Numeric Data Type

Python has many useful built-in data types. Python variables can store different types of data based on a variable's data type. Numeric data type represent the data which has numeric value. Numeric value can be integer, floating number or even complex numbers.

1. Integers

Integers are one of the Python data types. Its value is represented by int class. An integer is a whole number, negative, positive or zero (without fraction or decimal).


a = 5

Output: <class 'int'>

2. Floating

Floating point numbers or floats are another Python data type. Its value is represented by float class. Floats are decimals, positive, negative and zero. Floats can also be represented by numbers in scientific notation which contain exponents. The character e or E followed by a positive or negative integer may be appended to specify scientific notation.


a = 5.0

Output: float

3. Complex Numbers

 Complex number is represented by complex class. A complex number is defined in Python using a real component + an imaginary component j. The letter j must be used to denote the imaginary component.


a = 23 + 3j

Output: <class 'complex'>

Submitted by devanshi.srivastava on June 26, 2021

Devanshi, is working as a Data Scientist with iVagus. She has expertise in Python, NumPy, Pandas and other data science technologies.


At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.