# Python int

## Python int – Integer Datatype

int keyword in Python represents an integer. int is one of the basic built-in datatype among numeric types in Python.

In this tutorial, we shall learn what an integer is, how to initialize an integer, what range of values it can hold, what arithmetic operations we can perform, etc.

### Python int – Initialize

To initialize a variable with integer value, use assign operator and assign the integer value to the variable. Variable name has to be on the left hand side and the integer value has to be on the right side.

Following is a simple example, where we have multiple initialization for different variables with integer values.

``````x = 20
y = 45``````
Run this program

### Python int – Print to Standard Console Output

To print an integer to standard console output, you can use built-in function print(). print() accepts integer as argument.

In the following example, we shall initialize an integer and print it to console.

Python Program

``````x = 10
print(x)``````
Run this program

Output

``10``
Run this program

### Python Integer – Range or Bounds

As of Python 3, there is no bound on the maximum or minimum value an integer variable can hold.

In the following example, let us take some very large number and validate its type.

Python Program

``````x = 922337203685899999999999999999999998542114775897
print(x)
print(type(x))``````
Run this program

Output

``````922337203685899999999999999999999998542114775897
<class 'int'>``````
Run this program

### Python Integer – Arithmetic Operations

You can perform all arithmetic operations on integers.

In the following example, we shall perform arithmetic operations.

Python Program

``````a, b = 3, 4

print(a+b)

#subtraction
print(a-b)

#multiplication
print(a*b)

#integer division
print(a//b)

#float division
print(a/b)``````
Run this program

Output

``````7
-1
12
0
0.75``````

### Summary

In this tutorial of Python Examples, we learned about different aspects of integer in Python.