Mathematical operators
Computers can perform the four standard arithmetic operations – addition, subtraction, multiplication, and division. For example, we can write the following:
X1 = a + b Addition
X2 = a – b Subtraction
X3 = a * b Multiplication
X4 = a / b Division
The symbol for multiplication is * (the asterisk) and not the conventional x. Using the letter x to indicate multiplication would lead to confusion between the letter x and x as a multiplication operator.
Division is more complicated than multiplication because there are three ways of expressing the result of x ÷ y. For example, 15/5 is 3, and the result is an integer. 17/5 can be expressed in two ways – as a fractional value (i.e., a float) 3.4, or as 3 remainder 2. In Python, the division operator provides a float result if the result is not an integer (e.g., 100/8 = 12.5).
As well as the...