Name: Sourabh Shilawane
Practical: 3. Write simple Python program to demonstrate Operators
# Logical Operators
x = True
y = False
print("Logical Operators:")
print(f"x and y: {x and y}")
print(f"x or y: {x or y}")
print(f"not x: {not x}\n")
# Arithmetic Operators
a = 10
b=5
print("Arithmetic Operators:")
print(f"a + b = {a + b}")
print(f"a - b = {a - b}")
print(f"a * b = {a * b}")
print(f"a / b = {a / b}")
print(f"a % b = {a % b}")
print(f"a ** b = {a ** b}")
print(f"a // b = {a // b}\n")
# Bitwise Operators
m = 6 # Binary: 110
n = 3 # Binary: 011
print("Bitwise Operators:")
print(f"m & n (AND): {m & n}") # Binary AND: 010
print(f"m | n (OR): {m | n}") # Binary OR: 111
print(f"m ^ n (XOR): {m ^ n}") # Binary XOR: 101
print(f"~m (NOT): {~m}") # Binary NOT: -111
print(f"m << 1 (left shift): {m << 1}") # Binary left shift: 1100
print(f"m >> 1 (right shift): {m >> 1}") # Binary right shift: 011
Output: