Arithmetic Operators in Python


Arithmetic operators are used to perform mathematical operations like addition, subtraction, multiplication ,division and also python have floor division,exponentiation.

  • Addition ( + ) => This operator is a binary operator and is used to add two operands.
  • Subtraction ( - ) => This operator is a binary operator and is used to subtract two operands.
  • Multiplication ( * ) => This operator is a binary operator and is used to multiply two operands.
  • Division ( / ) => This is a binary operator that is used to divide the first operand(dividend) by the second operand(divisor) and give the quotient as result.
  • Modulus ( % ) => This is a binary operator that is used to return the remainder when the first operand(dividend) is divided by the second operand(divisor).
  • Exponentiation ( * * ) => The performs exponential (power) calculation on operators
  • Floor division ( / / ) => The division of operands where the result is the quotient in which the digits after the decimal point are removed.

Source Code

# Arithmetic operators
"""
+	Addition
-	Subtraction
*	Multiplication
/	Division
%	Modulus
**	Exponentiation
//	Floor division
"""
a = 123
b = 10
print(a + b)
print(a - b)
print(a * b)
print(a / b)
print(a // b)
print(a % b)
print(2**3)
To download raw file Click Here

Output

133
113
1230
12.3
12
3
8

List of Programs


Sample Programs


Python Database Connection


Python Flask


Python Tkinder Tutorial