## Operators in Python Assignment

**Python operators**

Python is an open source object oriented language. It is a high level powerful programming language. It is created by Guido Van Rossum in 1990. It is a derived from many other languages. Python programs are composed of modules and modules contain statements and statement s contains expressions and expressions create and process objects.

**Features of Python:**

- Python is open source software.
- It is easy to learn, easy to read and easy to maintain.
- It is portable. It has the same interface on all platforms. It is used on LINUX, Windows, UNIX any many more.
- It is high level language object oriented language.
- It has interactive mode. It interacts with interpreter directly to write and test program.
- Library is portable. It supports the GUI applications.
- It is extendable.
- It provides interfaces to all major commercial databases.
- It provides a better structure and support for large programs than shell scripting.

**Uses of python:**

- Web development
- Internet scripting
- System utilities
- Embedded scripting
- Database access and programming
- Distributed programming
- Game programming

**Operators of Python Language**

**Python supports many operators:**

**Arithmetic operators: let A = 10 and B = 5**

Operator |
Means |
Represent |
Result |

+ |
Addition |
A+B |
Sum of A and B = 15 |

- |
Subtraction |
A-B |
Subtract B from A = 5 |

* |
Multiplication |
A*B |
Multiple A with B = 50 |

/ |
Division |
A/B |
Divide A with B = 2 |

% |
Module |
A%B |
Remainder = 0 |

** |
Exponent |
A**B |
A to the power B |

// |
Floor |
A//B |
The division of operands where the result is the quotient in which the digits after the decimal point are removed. |

**Comparison Operator: let A = 10 and B = 5**

Operator |
Meaning |
Representation |
Result |

== |
Equality |
A == B |
It is not true. |

!= |
Not equal |
A != B |
It is true. |

> |
Greater then |
A > B |
It is true |

< |
Less then |
A < B |
It is false |

>= |
Greater than or equal to |
A >= B |
It is true |

<= |
Less Than and equal to |
A <= B |
It is false |

**Logical operator:**

Operator |
Representation |
Result |

And |
A and B |
Is true if both A and B are true |

Or |
A or B |
Is true if either A or B is true |

Not |
A not B |
If a condition is true then operator will make false. |

**Assignment Operator:**

Operator |
Short form |
Representation |
Result |

+= |
A += B |
A = A + B |
Add 2 number and assign the value to the left operand |

-= |
A -= B |
A = A - B |
Subtracts 2 number and assign the value to the left operand |

*= |
A *= B |
A = A * B |
Multiples 2 number and assign the value to the left operand |

/= |
A /= B |
A = A / B |
Divide 2 number and assign the value to the left operand |

%= |
A %= B |
A = A % B |
Module 2 number and assign the value to the left operand |

**= |
A **= B |
A = A ** B |
Calculate power and assign the value to the left operand |

//= |
A //= B |
A = A // B |
Performs floor division on operators and assign value to the left operand |

**Bitwise operator:**

Operator |
Short form |
Representation |
Meaning |

& |
And |
A & B |
Bits that are set in both A and B are set |

| |
Or |
A | B |
Bits that are set in either A and B are set |

^ |
Xor |
A ^ B |
Bits that are set in A or B but not both are set |

~ |
Not |
~A |
Bits that are set in A are not set, and vice versa |

<< |
Shift left |
A << B |
Shifts the bits of A , B steps to left |

>> |
Shift right |
A >> B |
Shift the bits of A ,m B steps to right |