Professional Documents
Culture Documents
PyAjinkya23 24
PyAjinkya23 24
Subject:
Experiment No: 1
Theory:
Program:
a) Arithmetic Operators
# Arithmetic operators
print("Addition:",Add)
print("Substraction:",sub)
print("Multiplication:",Mul)
print("Division:",Div1)
print("Modulus:",Mod)
P=num1**num2 #Power
print("Power:",P)
Output:
Program:
b) Assignment Operator:
# assigning 20 to x
x=20
# assigning 5 to y
y=5
x+=y #x=x+y
Output :
Sum of x+y : 25
Faculty Of MCA
Program:
c) Comparison Operators:
# equal to operator
print("a == b =", a == b)
Output:
Enter a number 1:18
Enter a number 2:13
a == b = False
a != b = True
a > b = True
a < b = False
a >= b = True
a <= b = False
Faculty Of MCA
Program:
d) Logical Operators:
# logical and
print(a==b and a>=b)
# logical or
print(a==b or a>=b)
Output:
Program:
e) Identify Operators:
x1 = 18
y1 = 13
x2 = 'Ajinkya'
y2 = 'Ajinkya'
Faculty Of MCA
print(x1 is not y1) # is not operator
Output:
True
True
Program:
f) Membership Operators:
a='Hello world'
# in operator
print('H' in a)
# not in operator
print('hello' not in a)
Output:
True
True
Conclusion:
Faculty Of MCA
Question/ Answers:
Faculty Of MCA