Understanding Numeric Data Types in Python

Understanding numeric data types in python. Integer, Float, Complex, and Boolean.

For Complete YouTube Video: Click Here

Numeric Data Types in Python

This numeric data types in python are.

  1. Integer
  2. Float
  3. Complex
  4. Boolean

Let’s take an example 5,8,0,-5,55.

All the above values are integers.

a=5 here in python variable a is assigned with an integer data type.

What is the maximum value we can assign?

In python, we don’t have any limit. we can assign any value.

Example take a=99999999. we can take a hundred 9’s.

In c and java, we don’t have that flexibility.

Take Floating-point numbers example x=2.55.

In python, floating-point numbers are represented using the double-precision format.

In double precision format, they use 64 bits to represent the value.

The maximum number that can be represented using floating point in python is 1.7976931348623157e+308.

The minimum positive value we can represent is 2.2*10power-308.

If we want to display any floating-point number above the maximum value it will show as inf. here inf means infinite.

Let’s understand complex numbers.

Example a = 2+5j.

a is a complex number.

type(a) is given as complex.

Boolean variables are taken two values. True or false.

a=True is a Boolean variable.

True is considered as 1 and false is considered as 0.

We discuss much the Boolean and complex variable in our next class when we discuss comparison operators.