the following Arithmetic operators. Operator - Operation Examples Result Assume a= and b= . Evaluate the following expressions + (Addition) >>> a + b - (Subtraction) >>>a – b * (Multiplication) >>> a*b / (Divisioin) >>> a / b . % (Modulus) >>> a % ** (Exponent) >>> a ** 10000 // (Floor Division) >>> a// (Integer Division) #Demo Program to test Arithmetic Operators a= b= print ("The Sum = ",a+b) print ("The Difference = ",a-b) print ("The Product = ",a*b) print ("The Quotient = ",a/b) print ("The Remainder = ",a% ) print ("The Exponent = ",a** ) print ("The Floor Division =",a// ) #Program End Output: The Sum = The Difference = The Product = The Quotient = .
The Remainder = The Exponent = 10000 The Floor Division = Program . To test Arithmetic Operators: (ii) Relational or Comparative operators A Relational operator is also called as Comparative operator which checks the relationship between two operands. If the relation is true, it returns True ; otherwise it returns False . 12th Computer Chapter - - Python supports following relational operators Operator - Operation Examples Result Assume the value of a= and b= .
Evaluate the following expressions. == (is Equal) >>> a==b False > (Greater than) >>> a > b True < (Less than) >>> a < b False >= (Greater than or Equal to) >>> a >= b True <= (Less than or Equal to) >>> a <= b False != (Not equal to) >>> a != b True #Demo Program to test Relational Operators a=int (input("Enter a Value for A:")) b=int (input("Enter a Value for B:")) print ("A = ",a," and B = ",b) print ("The a==b = ",a==b) print ("The a > b = ",a>b) print ("The a < b = ",a<b) print ("The a >= b = ",a>=b) print ("The a <= b = ",a<=b) print ("The a != b = ",a!=b) #Program End Output: Enter a Value for A: Enter a Value for B: A = and B = The