Follow us:
Python Program to do arithmetical calculation
This article shows that Python Program to do arithmetical calculation. The arithmetic calculations are performed by calculator where we can perform addition, subtraction, multiplication and division. In this article you see a basic example to do basic arithmetic operations in python i.e.
- Addition
- Subtraction
- Multiplication
- Division
Python program to find the area of a triangle.
Example:
Python
# Store input numbers:
num1 = input('Enter first number: ')
num2 = input('Enter second number: ')
# Add two numbers
sum = float(num1) + float(num2)
# Subtract two numbers
sub = float(num1) - float(num2)
# Multiply two numbers
mul = float(num1) * float(num2)
#Divide two numbers
div = float(num1) / float(num2)
# Print the sum
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))
# Print the subtraction
print('The subtraction of {0} and {1} is {2}'.format(num1, num2, sub))
# Print the multiplication
print('The multiplication of {0} and {1} is {2}'.format(num1, num2, mul))
# Print the division
print('The division of {0} and {1} is {2}'.format(num1, num2, div))
Note: Here input numbers are 5 and 6.
Output:
Note: If you interested lo learn Python through web, You can click here
Conclusion:
Hi guys, I can hope that you can know that how to write a Python Program to do arithmetical calculation. If you like this post as well as know something new so share this article in your social media accounts. If you have any doubt related to this post then you ask in comment section.