python operators

Python is the most popular programming language of 2020. If you want to become a good software developer then you must know the python programming language.

python operators:-

                                                    Operators are used to perform operations on the operants ( variables and values.)
Python divides the operators into the following groups:
  1. Arithmetic operators
  2. Assignment operators
  3. Comparison operators
  4. Logical operators
  5. Identity operators
  6. Membership operators
  7. Bitwise operators
Lets Discuss one by one.

1.Arithmetic operators in Python:-

These are those operators which perform an arithmetic operation. Followings are the important arithmetic operator in python.

Addition (+)             Adds values on either side of the operator.
Subtraction (-)             Subtracts right hand operand from left hand operand.
Multiplication (*)     Multiplies values on either side of the operator.
Division(/)             Divides left hand operand by right hand operand.
Modulus(%)             Divides left hand operand by right hand operand and returns remainder.
Exponent(**)             Performs exponential (power) calculation on operators.
Floor Division(//)       The division of operands where the result is the quotient in which the digits                                            after the decimal point are removed. But if one of the operands is negative, the                                      result is floored, i.e., rounded away from zero (towards negative infinity) −                                         example:- 9//2 = 4 and 9.0//2.0 = 4.0, -11//3 = -4, -11.0//3 = -4.0

Following Source code explain you in a better way:-

Output of the above code:-

No comments:

Powered by Blogger.