# Python Numbers

Hii Folks, Now we are going to drive more under python. In this module, we will be learning What are python numbers. Today we will be learning one of the most required and important topics which are very useful and helps you to play with variable data types very easily. So let’s start.

## Python Numbers

Python Numbers are the number data types that store numeric values. By changing the value of the number datatype it results in a memory allocated object. Therefore, they are said to be immutable data types.

## Types of Number Data Types

There are three types of number datatype which is as follows:

• Int
• Float
• Complex

Let see more about each type ### Int Type

These data types include all positive and negative numbers but not the fractions. In Python, there are no such limitations on the length of integers.

```n=1234
type(n)

//Output
//<class 'int'>```

### Float Type

These Data types represent the float or decimal value. It can be either positive or negative. Float can also ‘’E’’which is the scientific tool used to indicate the power of 10.

Note: The accuracy on float numbers will be up to 15 decimal places. In sixteenth place, it will give inaccurate results.

```n=12.34
type(n)

//Output
//<class float'>```

### Complex Type

This is the type of data type which consists of a real and imaginary number.
For Example,3+5j is a complex number that consists of 3 as a real number and 5 is multiplied by an imaginary number (j).

```n=234+123j
type(n)

//Output
//<class 'complex'>```

## Number type conversion

Various number types like int, float, and complex are also functions in python. This function wraps one data type into another data type. Python performs typecasting internally and binds the values to their actual types. In some cases, we need to define data types explicitly.

For example, To input integer values we first use int typecasting in the input function.
int(input()):Converts string data type to integer data type.
Following functions that are used to perform type conversion are:

```num="9876"
type(num)
num1=int(num)
type(num1)
num2=float(num)
type(num2)

//Output
//<class 'int'>
//<class 'strt'>
//<class 'float'>```

## Python Number functions

There are various in-build functions that are used to perform specific operations.
Some function is as follows:

## Random number function

These functions are generally used in building gaming and to create uncertainty.It provides in-built functions to manipulate and generate random numbers. It can select the random element from the list or a sequence in Python.
The following Random numbers are as follows

Hope you enjoyed reading our content, In this module, we get to know the importance of typecasting and how it can be done. Using various functions we can typecast the element and by using various random numbers functions we can get any random number from the sequence of a list. To get the basic knowledge of python you can go through Python Syntax.