Python Arithmetic Operators

Video Tutorial
FREE
Arithmetic Operators thumbnail
This video belongs to
Python Course for Beginners With Certification: Mastering the Essentials
16 modules
Certificate
Topics Covered

Overview

An Arithmetic Operator is a mathematical function that performs a calculation on two operands. The different types of arithmetic operators include addition, subtraction, multiplication, division, modulus, exponentiation and floor division.

Introduction to Python Arithmetic Operators

Imagine you are at a store buying groceries, and there is a big sale. You are standing in the queue, and you quickly pull out your phone to calculate how much discount you are supposed to get. Calculators act as a big lifesaver in real life.

But what runs these calculations?

The answer is simple- Operators!

A calculator can perform simple arithmetic operations for us using operators such as addition, subtraction, multiplication, division, etc. Similarly, in the world of coding, Arithmetic Operators in Python come to our rescue and make our job easier!

Learn more about Calculator Program in Python.

In this article, we will deep-dive everything about Arithmetic Operators in Python and learn how to use them.

Let’s first begin by learning about the different Arithmetic Operators in Python.

Scaler Placement Report and Statistics

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data

Types of Arithmetic Operators in Python

Primarily, Arithmetic Operators in Python are of the following types-

  1. Addition
  2. Subtraction
  3. Multiplication
  4. Division
  5. Modulus
  6. Exponentiation
  7. Floor Division

Now, let’s take a closer look at them and try to understand them better.

Transform Your Career

Choose from our industry-leading programs designed for career success

NSDC Certified

Modern Software and AI Engineering Program

Master full-stack development with AI integration

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Modern Data Science and ML with specialisation in AI

Advanced data science techniques with AI specialization

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Advanced AIML with Specialisation in Agentic AI

Deep dive into AIML with focus on Agentic systems

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

DevOps, Cloud & AI Platform Engineering

Build and manage AI-powered cloud infrastructure

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

AI Engineering Advanced Certification by IIT-Roorkee

Premier AI engineering certification from IIT-Roorkee

3 MonthsDuration
AI-LedCurriculum
Career SupportSupport
Program highlights
Go to Program

1. Addition

The addition operator in Python is “+”. It is used to add or sum two values.

Let’s see its code implementation-

Code:

Output:

2. Subtraction

Let’s see how it works in Python-

Code:

Output:

Scaler Placement Report and Statistics

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data

3. Multiplication

The Arithmetic Operator in Python for multiplication is “*”. With this operator, we can find the product of two values.

Check out the following code snippet for a better understanding-

Code:

Output:

4. Division

The “/” operator is the division operator in Python. We can find the quotient when the first operand is divided by the second.

Let’s see how we can code it-

Code:

Output:

Turn Learning into Career Growth

1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary
1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary

5. Modulus

The “%” operator is the division operator in Python. Using this, we can find the remainder when the first operand is divided by the second.

Check out this code implementation-

Code:

Output:

6. Exponentiation

The exponentiation operator in Python is denoted by “**”. It is used to raise the power of the first operand to the power of the second.

Let’s see the following code snippet to understand this better-

Code:

Output:

7. Floor Division

It is denoted by “//” in Python. We use it to find the floor of the quotient when the first operand is divided by the second.

Code:

Output:

NameOperatorExample
Addition+a+b
Subtraction-a-b
Multiplication*a*b
Division/a/b
Modulus%a%b
Exponentiation**a**b
Floor Division//a//b

Example to Implement Arithmetic Operators in Python

Let’s look at one comprehensive example of Arithmetic Operators in Python-

Code:

Output:

Check out this article to learn about Format() function in Python.

Explore Scaler Topics Python Tutorial and enhance your Python skills with Reading Tracks and Challenges.

Conclusion

We have now reached the end of the article! Let’s summarize what we have learned so far-

  • We learned what Arithmetic Operators in Python are.
  • We covered the different types of Arithmetic Operators in Python.
  • We saw their code implementations.

Now, you are all set to use Arithmetic Operators in Python on your own. Happy coding!

Learn More:

Hiring Partners:
GoogleGoogleAmazonAmazonMicrosoftMicrosoftFlipkartFlipkartAdobeAdobe1200+ more