Operators in Python

Type  Operator Name Example Description
 Urinary Operator      – Minus    – x Negates the numeric argument
      + Plus   + x numeric argument unchanged.
      ~ Invert – (x + 1) bit-wise inversion of x
Arithmetic Operator     + Addition    x + y Add two operands using ‘+’ operator in between
       – Subtraction    x – y subtract two operands using the ‘-‘ operator in between
       * Multiplication    x * y Multiply two operands using ‘*’ operator in between
      / Division    x / y Divide left operand with right operand using ‘/’ operator
      // Floor Division   x // y

Divide left operand with right operand using ‘//’ operator

and provide the only quotient as an output

     ** Exponentiation   x ** y Exponentiation (power) x to the power y
      % Modulo   x % y

Divide left operand with right operand using ‘%’ operator

and provide the only remainder as an output

How To Do Math in Python 3 with Operators?

Python3 provides us data types like integer and float along with various operators to perform mathematical calculations for graph plotting, machine learning algorithms, Statistical, data analytical purposes. An operator is a symbol that performs specific operations, which is very useful if one is frequently dealing with numbers. Operator precedence specifies the order in which operators are evaluated when two or more operators with different precedence are adjacent in an expression.  Below is a quick reference table for Unary Operators and Arithmetic Operator.

Similar Reads

Operators in Python

Type  Operator Name Example Description  Urinary Operator      – Minus    – x Negates the numeric argument       + Plus   + x numeric argument unchanged.       ~ Invert – (x + 1) bit-wise inversion of x Arithmetic Operator     + Addition    x + y Add two operands using ‘+’ operator in between        – Subtraction    x – y subtract two operands using the ‘-‘ operator in between        * Multiplication    x * y Multiply two operands using ‘*’ operator in between       / Division    x / y Divide left operand with right operand using ‘/’ operator       // Floor Division   x // y Divide left operand with right operand using ‘//’ operator and provide the only quotient as an output      ** Exponentiation   x ** y Exponentiation (power) x to the power y       % Modulo   x % y Divide left operand with right operand using ‘%’ operator and provide the only remainder as an output...

Operator Precedence

Operator Meaning Associativity       ** Exponent Right-to-left      ~x  Bitwise NOT (Invert) Left-right   +x, -x Unary plus, Unary minus Left-right *, /, //, % Multiplication, Division, Floor division, Modulus Left-right      +, –  Addition, Subtraction Left-right...

Contact Us