In this tutorial, learn how to create integer in python. The short answer is: assign a numeric value without a decimal. You can assign a positive or negative value to a variable to create integer.

Create Integer in Python With Positive Value

To create a positive integer variable, you have to assign a positive value to it. After you assign a positive numeric value without any decimal point. You can start using it on your Python programming as a positive integer variable. You may also like to read how to create a variable in Python.

To print the integer variable in the output, you have to use the print statement of Python. Check the below example and also find out if it is a python integer variable. Use the Python type() to check the type of the Python variable.


<class ‘int’>

The above example prints the positive integer variable. After that, the type() function finds the type of the variable and print the type in the output. Check the output to find out how it prints the variable type.

Create Integer in Python With Negative Value

In addition to the above positive integer variable type. Python also allows creating a variable with a negative value. To create a negative integer variable of Python. You have to assign a non-decimal numeric value with minus(-) sign before the value.

See the example below to find out how to create integer in python with a negative value. Also check, if the negative numeric value variable is of integer type using the type function.


<class ‘int’>

The above prints the negative integer value and the type of the integer variable. You can create your own integer variable and apply different operations on it.

Declare integer variable in Python

Hope, you like this tutorial of how to create integer in Python. If you have any query regarding the tutorial, please comment below.

Also tell me, which method are you using to create your own integer variable in Python.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.