What are different arithmetic operators in Python?

PythonServer Side ProgrammingProgramming

Arithmetic operators in Python are explained below −

+ for addition − performs addition of operands on either side

>>a=5
>>b=7
>>c=a+b
>>c
12

- for subtraction − subtracts second operand from first

>>a=10
>>b=5
>>c=a-b
>>c
5

* for multiplication − multiplies first operand by second

>>a=5
>>b=2
>>c=a*b
>>c
10

/ for division − divides first operand by second

>>a=10
>>b=5
>>c=a/b
>>c
2

% for modulo or remainder − returns remainder of division of first operand by second

>>a=10
>>b=3
>>c=a%b
>>c
1
raja
Published on 10-Feb-2018 08:05:28
Advertisements