Python Data Types – Python Numbers

In this Python tutorial we are going to talk about Python Data Types, especially we are going to create example on Python Numbers Data Types. so when you create a value in Python, every value in Python has it’s own data type. for example variables can store data of different types. there are different data types that you can use. but in this tutorial we are going to create examples on numbers. also you can watch the complete video tutorial for this article.

 

 

 

 

ٌWatch the complete Video Tutorial 

 

 

 

 

Python Numbers 

So Python Numbers or Numeric are divided in to three parts, Integer, Float and Complex Number.

 

 

Integers 

The size of an integer is limited only by the machine’s memory, so integers
hundreds of digits long can easily be created and worked with although they
will be slower to use than integers that can be represented natively by the
machine’s processor.

 

 

This is the result

 

 

Also you can find the type of a value by using type() function.

 

 

This is the result.

 

 

 

Floating 

Python provides three kinds of floating-point values: the built-in float and
complex types, and the decimal.Decimal type from the standard library. All three
are immutable. Type float holds double-precision floating-point numbers
whose range depends on the C (or C# or Java) compiler Python was built with,
they have limited precision and cannot reliably be compared for equality.
Numbers of type float are written with a decimal point, or using exponential
notation, for example.

 

 

 

The output is

 

 

Also you can find the type of a value by using type() function.

 

 

This is the output

 

 

 

Complex Numbers 

The complex data type is an immutable type that holds a pair of floats, one
representing the real part and the other the imaginary part of a complex
number. these are the examples.

 

 

 

This is the output.

 

 

Also you can find the type of a value by using type() function.

 

 

 

This is the output.

 

 

 

 

Subscribe and Get Free Video Courses & Articles in your Email

 

Share via
Copy link
Powered by Social Snap
×