Page 86 - TP_Modular_V2.1_Class6
P. 86
Operator Name Description Example Output
(x=7 and
y=3)
/ Division Divides left hand operand by right hand x / y 2.33
operand.
% Modulus Divides left hand operand by right hand x % y 1
operand and returns remainder.
** Exponentiation Performs exponential (power) calculation x ** y 343
on operands.
// Floor or Divides and cuts the fractional part from x // y 2
Integer the result.
division
Program 1: To perform all the arithmetic operations
Program1.py
File Edit Format Run Options Window Help
#Program to perform from arithmetic operators
a = 9
b = 4
add = a + b #Addition
sub = a - b #Subtraction
mul = a * b #Multiplication
div = a / b #Division
divl =a // b #Floor Division
mod = a % b #Modulus
power = a **b #Power
print ("Sum is : ", add, " Difference is : " , sub, " Product is : "
,mul, " Decimal division is : ", div, " Integer division is : " ,divl,"
Remainder is : ", mod, " Raised to the power is : ", power)
Output
Sum is : 13 Difference is : 5 Product is : 36 Decimal division is : 2.25
Integer division is : 2 Remainder is : 1 Raised to the power is : 6561
Assignment Operators
The assignment operators are used to assign the value of the right expression to the left operand.
The assignment operators are described in the following table:
84 Modular (Ver. 2.1)-VI

