Python Arithmetic Operators

Python Arithmetic Operators:

We can use the PyCharm code editor for this example. If you do not know about it then follow this link- How to install PyCharm for Python and create a program in it.

(1) Python supports arithmetic operators that are used to perform the four basic arithmetic operations as well as modular division, floor division, and exponentiation.

OperatorNameExample
+Additiona + b
Subtractiona – b
*Multiplicationa * b
/Divisiona / b
%Modulusa % b
**Exponentsa ** b
//Floor Divisiona // b

(2) Example of four basic arithmetic operators is given below.

basic arithmetic operators in Python

(3) Example of modular division, floor division, and exponentiation is given below.

  • Modular Division (%)- Divides the operand on the left by the operand on the right and returns the remainder.
  • Floor Division (//)- Divides the operand on the left by the operand on the right and returns the quotient by removing the decimal part. It is sometimes also called integer division.
  • Exponentiation (**)- Performs exponential (power) calculation on operands. That is, raise the operand on the left to the power of the operand on the right. For example- 9**2 = 9*9; 9**3 = 9*9*9 etc.
modular, floor division and exponentiation in python

How to Create Variables in Python
String Concatenation in Python
Tutorial MySQL
Python (programming language)– Wikipedia
Modular Programming
Programming Languages

Object-Oriented Programming (OOP)
Structured Programming

Comments (No)

Leave a Reply