addition operator python - Search
Open links in new tab
  1. Python provides a variety of arithmetic operators that allow you to perform common mathematical operations on numerical values. These operators include addition, subtraction, multiplication, division, modulus, exponentiation, and floor division.

    Basic Arithmetic Operators

    Here are the basic arithmetic operators in Python:

    • Addition (+): Adds two operands.

    x = 5
    y = 3
    result = x + y
    print(result) # Output: 8
    • Subtraction (-): Subtracts the second operand from the first.

    x = 5
    y = 3
    result = x - y
    print(result) # Output: 2
    • Multiplication (*): Multiplies two operands.

    x = 5
    y = 3
    result = x * y
    print(result) # Output: 15
    • Division (/): Divides the first operand by the second, returning a float.

    x = 5
    y = 3
    result = x / y
    print(result) # Output: 1.6666666666666667
    • Modulus (%): Returns the remainder when the first operand is divided by the second.

    x = 5
    y = 3
    result = x % y
    print(result) # Output: 2
    • Exponentiation (**): Raises the first operand to the power of the second.

    x = 5
    y = 3
    result = x ** y
    print(result) # Output: 125
    Feedback
    Kizdar net | Kizdar net | Кыздар Нет
  1. Some results have been removed