print("Operators in Python")
print()
print("Enter 2 nos (try to enter first no > second ) ")
a = float(input("Enter first no:- "))
b = float(input("Enter second no:- "))
print()
print("1. Arithmetic Operators:");
s = (a + b)
print("1.1 Addition:- " ,s );
s = (a - b);
print("1.2 Substraction:- " , s);
s = (a * b)
print("1.3 Multiplication:- " ,s);
s = (a / b)
print("1.1 Division:- " ,s);
s = (a % b)
print("1.4 Modulas:- " ,s);
s = (a ** b)
print("1.5 Exponent:- " ,s);
s = (a // b)
print("1.6 Floor Division:- " ,s);
print()
print()
print()
print()
c = 10
d = 10
e = 15
f = 20
print("2. Relational Operators")
print(" Values of variables:- ")
print(" |c = 10 | d = 10 | e = 15 | f = 20|")
print("2.1 Equal to :-");
if ( c == d):
print("c and d are is equal")
else:
print ("c and d are not equal")
print()
print("2.2 Not Equal to '<>' :-");
if ( f != d):
print ("f and d are not is equal")
else:
print ("f and d are equal")
print()
print("2.3 Greater than :-");
if ( f > c ):
print ("f is greater than c")
else:
print ("f is not greater than c")
print()
print("2.4 Less than :-");
if ( c < f ):
print ("c is lesser than f")
else:
print ("c is not less than f")
print()
print("2.5 Less than and Equal to :-");
if ( c <= d ):
print ("c is less than equal to d")
else:
print ("c is not less than equal to d")
print()
print("2.6 Greater than and Equal to :-");
if ( c <= d ):
print ("c is Greater than equal to d")
else:
print ("c is not Greater than equal to d")
print()
print()
print()
print()
print("3.0 Assignment Operators")
n = int( input("Enter a Integer Value:- ") )
print("3.1 Assignment (Entered value assigned to variable 'n'):- ",n)
print()
n += 10
print("3.2 Add then Assign (Final changed value of variable 'n'):- ",n)
print()
n -= 10
print("3.3 Subtract then Assign (Final changed value of variable 'n'):- ",n)
print()
n *= 10
print("3.4 Multiply then Assign (Final changed value of variable 'n'):- ",n)
print()
n /= 10
print("3.5 Divide then Assign (Final changed value of variable 'n'):- ",n)
print()
n %= 10
print("3.6 Modulas then Assign (Final changed value of variable 'n'):- ",n)
print()
n = 2
n **= 10
print("3.7 Exponent then Assign (Final changed value of variable 'n'):- ",n)
print()
n //= 10
print("3.8 Floor division then Assign (Final changed value of variable 'n'):- ",n)
print()
print()
print()
print()
print("4.0 Logical Operators")
c = 10
d = 14
e = 17
f = 20
print(" Values of variables:- ")
print(" |c = 10 | d = 14 | e = 17 | f = 20|")
if( e > 15 and e < 20):
print("4.1 Logical AND [ value of e is between 15 and 20]")
print()
if( e > 21 or e < 18):
print("4.2 Logical OR [Any one condition True statement is executed]")
print()
if(not( e > 20 )):
print("4.3 Logical NOT [if Condition is false the statement gets
executed]")
print()
print()
print()
print()
print()
List = [1,2,3,4,5,6,7,8]
i=1
print("5. Membership Operators")
print("List contents:- ",List)
print("Value of variable i:- " ,i)
print("5.1 IN operator")
if i in List:
print("i is available in list")
else:
print("i is not available in list")
print()
i = 9
print("Value of variable i:- " ,i)
print("5.2 NOT IN operator")
if i not in List:
print("i is not available in list")
else:
print("i is available in list")
print()
print()
print()
print()
print("6.0 Identity Operators")
c = 10
d = 10
e = 15
print(" Values of variables:- ")
print(" |c = 10 | d = 10 | e = 15 |")
print("6.1 IS Operator")
if( c is d ):
print("c and d have same values")
else:
print("c and d don't have same values")
print()
print("6.2 IS NOT Operator")
if( c is not e ):
print("c and e don't have same values")
else:
print("c and e have same values")
print()
input("")