Home > Article > Backend Development > How to define integers in python
The Python number type includes the integer type, which is one of the immutable data types. Some of its properties are the same as strings.
Python int has multiple number types: int, long, bool, float, and complex.
Creation and declaration of integer type int
Creating a new integer type variable and assigning a value to the variable are the same process
a = 123 or b = -123 The left side of the equal sign is the variable name, and the right side is the value to be assigned. It's that simple.
Characteristics of integers
Since it is an integer, the data during natural assignment must be integers. Integers are simply understood as (positive integers and negative integers)
Arithmetic operators and methods between integer variables
The operators in front of integer data type variables that python can currently support are: addition (+), subtraction (-), multiplication (*), division (/) and power (**)
If you want to quote the result between two variables, remember to reassign the value before quoting.
The above is the detailed content of How to define integers in python. For more information, please follow other related articles on the PHP Chinese website!