Page 118 - ConceptGP_C8_Fb
P. 118
However, the text written inside triple quotes (''' or ''"") is also considered as comment. You
can use the triple quotes to write multiline comments. For example:
'''This is """This is
Multiline OR Multiline
Comment''' Comment"""
Operators
In Python, operators can be defined as special symbols which perform arithmetic and logical
computation. The values which the operators use to get the output are called operands. For
example, in the expression 10 – 5, 10 and 5 are operands and the minus (–) sign is the operator.
Python divides the operators in the following categories.
Arithmetic Operators
Arithmetic operators perform arithmetic operations between two operands. The arithmetic
operators are defined in the following table:
Example
Operator Name Description (x=7 and Output
y=3)
Adds values on either side of the
+ Addition x + y 10
operator.
– Subtraction Subtracts right hand operand from x – y 4
left hand operand.
* Multiplication Multiplies values on either side of the x * y 21
operator.
/ Division Divides left hand operand by right x / y 3
hand operand.
% Modulus Divides left hand operand by right x % y 1
hand operand and returns remainder.
** Exponentiation Performs exponential (power) x ** y 343
calculation on operands.
// Floor or Integer Divides and cuts the fractional part x // y 2
division from the result.
116 Premium Edition-VIII

