Skip to content
Home » Blog » Python program to do arithmetical operations

Python program to do arithmetical operations

Python Program to do arithmetical operations

In this tutorial, you’ll learn how to perform Python Arithmetical Operations.

Here you’ll learn how python does the basic arithmetical operations which are

  1. Addition
  2. Subtraction
  3. Multiplication
  4. Division

You’ll all the above operation by making a simple calculator which performs all the operations simultaneously.

Program to Perform Arithmetical Operations

num1 = input('Enter first number: ')  
num2 = input('Enter second number: ')  
# Add two numbers  
sum = float(num1) + float(num2)  

# Subtract two numbers  
min = float(num1) - float(num2)  

# Multiply two numbers  
mul = float(num1) * float(num2)  

#Divide two numbers  
div = float(num1) / float(num2)  

# Display the sum  
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))  
# Display the subtraction  
print('The subtraction of {0} and {1} is {2}'.format(num1, num2, min))  

# Display the multiplication  
print('The multiplication of {0} and {1} is {2}'.format(num1, num2, mul))  

# Display the division  
print('The division of {0} and {1} is {2}'.format(num1, num2, div))  


Enter first number: 12
Enter second number: 24
The sum of 12 and 24 is 36.0
The subtraction of 12 and 24 is -12.0
The multiplication of 12 and 24 is 288.0
The division of 12 and 24 is 0.5

Related Program

  1. Python Program to Solve Quadratic Equation
  2. Python Program to Generate Random Number
  3. Python Program to Generate a Random Alphanumeric String
  4. Python Program to Swap Two Variables
  5. Python Program to Convert Celsius To Fahrenheit
  6. Python Program to Convert Kilometers to Miles
  7. Python Program to Find LCM
  8. Python Program to Find HCF or GCD
  9. Python Program To Display Powers of 2 Using Anonymous Function
  10. Python  Program to Display Calendar

Ask your questions and clarify your doubts by commenting. Python Documentation

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.