This repository contains Python programs demonstrating various operators. It covers arithmetic, comparison, logical, and assignment operators, with examples for each.
- Examples of different types of operators in Python.
- Clear explanations and practical code snippets.
- Demonstrates how to use operators in real-world scenarios.
An arithmetic operator is a mathematical function that performs a calculation on two operands
solution:
Arithmetic operators
Add = 77
Sub = 13
Mul = 1440
Div = 1.40625
Mod = 13
Exp = 79946681398258369524447459012293256819248199462890625
F.D = 1
Left shift
40
Bitwise NOT(~)
-11
9
Bitwise OR
236
There are used to compare two relational expressions, after comparison it gives True or False.
True
False
False
False
True
True
True
False
False
True
In fix which are used to perform operations on variables or operands and assign values to the operand on the leftside of the operator.
a= 40
a+= 80
a-= 40
a*= 1600
a/= 40.0
a%= 0.0
a//= 0.0
It is used to compare the two operands and it returns true or false.
True
False
True
False
True
True
False
1} Bitwise Right Shift Operator
The bitwise right shift operator in python shifts the bits of the binary representation of the input number to the right side by a specified number of places. The empty bits created by shifting the bits are filled by 0s.
2} Bitwise Left Shift Operator
The bitwise left shift operator in Python shifts the bits of the binary representation of the input number to the left side by a specified number of places. The empty bits created by shifting the bits are filled by 0s.
Right shift
Right shift is: 1
Left shift
Left shift is: 48