Ranges of Data Types in Python

Ranges of Data Types :

Data types are the classification of data items. It represents that kind of value which tells what operations can be performed on a particular data type. Everything is an object in Python programming, data types are actually classes and variables are instance  of these classes. 

Range of Data Types in Python

Ranges of Data Types : 

In python , value of an integer/float is not fixed and it can be as large as possible until our memory has some space to accomodate it. So we never need any special keyword for large integer or float like c/c++ have.

Platform-dependent, typically 32 or 64 bits, allowing values from approximately -2^31 to 2^31-1 or -2^63 to 2^63-1.

Hence python 3 has only integer and float , but in python 2.7 there was two types :

  • integer int
  • Long int

Code 1:

Here , we will write a program in Python to understand ranges of data types for better understanding.

Run
#python Program
#Range on data type 
x=99999999999999999999999999999999999999999999999999999999999999999999999
print('X is = ' , x)
y=0.000000000000000000000000000000000000000000000000000000000000000000001
print('Y is = ' , y)

Output :

X is = 99999999999999999999999999999999999999999999999999999999999999999999999
Y is = 1e-69

In the code, x is integer (int) and y is long integer (long int).

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription