Arithmetic Operators

Arithmetic Operators in Python are used to perform basic mathematical operations like addition, subtraction, multiplication, and division.

What are Arithmetic Operators in Python

Arithmetic operators are symbols used to perform mathematical operations on numbers or variables.

They help programmers perform calculations easily inside Python programs.

Why Arithmetic Operators are Important

Arithmetic operators are important because they help:

  • perform calculations
  • solve mathematical problems
  • build calculators
  • process data
  • create gaming logic
  • calculate marks and percentages
  • develop financial applications

Without arithmetic operators, mathematical programming would not be possible.

Real-Time Scenario

Exponent is used in:

  • scientific calculations
  • AI algorithms
  • mathematics software
  • engineering applications

Explanation

These operators help us calculate values in a program, just like using a calculator.

They are widely used in:

  • School programs
  • Coding projects
  • Real-life calculations

Learning arithmetic operators in Python is the first step to mastering programming.

Common Arithmetic Operators

Operator Name Example Output Description
+ Addition 10 + 5 15 Adds two numbers
- Subtraction 10 - 5 5 Subtracts one number from another
* Multiplication 10 * 5 50 Multiplies two numbers
/ Division 10 / 5 2.0 Divides one number by another and returns float value
% Modulus 10 % 5 0 Returns the remainder after division
** Exponent 2 ** 3 8 Raises a number to the power of another number
// Floor Division 10 // 3 3 Divides and returns only the whole number part

Example 1

#Arithmetic operations
a = 10
b = 3

# Perform arithmetic operations
print("Addition:", a + b)            
print("Subtraction:", a - b)         
print("Multiplication:", a * b)      
print("Division:", a / b)            
print("Modulus:", a % b)             
print("Exponent:", a ** b)           
print("Floor Division:", a // b)     

Output:

Addition: 13
Subtraction: 7
Multiplication: 30
Division: 3.3333333333333335
Modulus: 1
Exponent: 1000
Floor Division: 3

 

Explanation of Output

  • + → Adds numbers
  • - → Subtracts numbers
  • * → Multiplies numbers
  • / → Gives decimal result
  • % → Gives remainder
  • ** → Power (10³ = 1000)
  • // → Gives whole number

Example 2

# Arithmetic Operators Example 
x = 20
y = 4

sum = x + y
difference = x - y
product = x * y
division = x / y
remainder = x % y
power = x ** y
floor_div = x // y

print("Sum =", sum)
print("Difference =", difference)
print("Product =", product)
print("Division =", division)
print("Remainder =", remainder)
print("Power =", power)
print("Floor Division =", floor_div)

Output:

Sum = 24
Difference = 16
Product = 80
Division = 5.0
Remainder = 0
Power = 160000
Floor Division = 5

Common Beginner Mistakes

  • Confusing / and //
  • Forgetting operator symbols
  • Using wrong operator for calculations
  • Not understanding remainder (%)

➤ Summary

  • Arithmetic operators are used for calculations
  • Used in daily life math problems
  • Important for Python beginners
  • Help build logic and problem-solving skills

Check your knowledge

Quickly verify what you've learned from this tutorial.

Question 1

Why are Arithmetic Operators important in Python programming?

Arithmetic operators are used to perform calculations and solve real-world problems in programs.

Question 2

What does % operator do?

% returns the remainder after division.

Question 3

What is the output?

print(10 // 3)

// returns the integer part (floor value).

Question 4

What is the output?
print(2 ** 3)

** means power → 2³ = 8.

Question 5

What is the output?

x = 15
y = 4

print(x % y + x // y)

15 % 4 = 3 and 15 // 4 = 3 → total = 6.

Congratulations!

You've successfully mastered the knowledge check for "Arithmetic Operators."

For more questions and practice, click the link below:

Practice More Questions
Previous Topic Operators & Decision Making Next Topic Comparison Operators