Page 118 - Computer Genius Class 08
P. 118
Arithmetic Operators
Arithmetic operators are used to perform mathematical operations like addition, subtraction,
multiplication etc.
Operator Meaning Example
+
Add two operands or unary plus x + y
(Addition)
-
Subtract right operand from the left or unary minus x - y
(Subtraction)
*
Multiply two operands x * y
(Multiplication)
/ Divide left operand by the right one
x / y
(Division) always results into oat
% Remainder of the division of left operand by the
x % y
(Modulus) right (remainder of x/y)
// Division that results into the whole-number adjusted
x // y
(Floor Division) to the left in the number line
**
A type of Multiplication where a value is multiplied
(Exponentiation/ x ** y
with itself for a certain number of times
Power Operator)
Assignment Operators
Assignment operators (=), are used to assign values to variables. It assigns values from the
right-side operands to the left-side operands.
Example:
a=5
This is a statement assignment that assigns value ‘5' to the variable ‘a’ on the left.
Notes
‘5=a’ is an incorrect assignment statement, as the values are assigned
from the right side to the left side.
Comparison Operators
Comparison operators are the operators that compare the values on either side of the symbol.
Depending on their operation, these checks if the two operands satisfy the given condition. Then
return either "True" or "False" based on the result.
116 Computer Genius-VIII

