riven

Riven

Riven

python arithmetic operators

Arithmetic operators are used to perform basic mathematical operations.

In Python, the common arithmetic operators include addition, subtraction, multiplication, division, modulus, exponentiation, and floor division

Arithmetic operators are symbols used to perform mathematical calculations. The most common ones are:

  1. Addition (+): Adds two numbers.

    • Example: 3+5=83 + 5 = 8
  2. Subtraction (−): Subtracts one number from another.

    • Example: 10−4=610 – 4 = 6
  3. Multiplication (× or *): Multiplies two numbers.

    • Example: 6×3=186 \times 3 = 18
  4. Division (÷ or /): Divides one number by another.

    • Example: 12÷4=312 ÷ 4 = 3
  5. Modulus (%): Gives the remainder of a division operation.

    • Example: 10%3=110 \% 3 = 1

1. Addition (+)

The addition operator is used to add two numbers together. It can also concatenate strings and combine lists.

Example:

python arithmetic operators

2. Subtraction (-)

The subtraction operator subtracts the right operand from the left operand.

Example:

adding two integer

3. Multiplication (*)

The multiplication operator multiplies two numbers. It can also be used to repeat sequences like strings and lists.

Example:

multiple two integer

4. Division (/)

The division operator divides the left operand by the right operand and always returns a float, even if the division is exact.

Example:

dividing two integer

5. Floor Division (//)

The floor division operator divides the left operand by the right operand and returns the largest integer less than or equal to the result.

Example:

6. Modulus (%)

The modulus operator returns the remainder of the division of the left operand by the right operand.

Example:

7. Exponentiation (**)

The exponentiation operator raises the left operand to the power of the right operand.

Example: