Integers are whole numbers that can be , , or zero, such as -3, 0, 5, etc. In Python, you can store integers in variables just like any other data type. For example: num1 = 10, num2 = -5, and num3 = . You can perform operations directly on integer variables and store the results in a new variable. For example, result = num1 + num2, which will output .
Python provides the operator to add two integers. For example, print(3 + 5). The - operator is used for subtracting one integer from another, such as in print(10 - 6). For multiplication, Python uses the operator, so you might have x = 4 * 5, and then print(x). The / operator performs normal division and returns a , while the // operator performs floor division and returns the quotient as an .
Sometimes, you may need to convert an integer into a string or . Python allows you to easily convert between these data types using the str() and int() functions. For instance, to convert the integer 10 into a string, you can use the str(10) function, resulting in the string . When you convert a number to a string, the mathematical operators no longer work like before, leading to differences like '5' + '4', which results in .