Python program to use arithmetic operators for carrying out simple operations

In this example, we will write a simple program that takes input from the user and perform a basic arithmetic operation in Python. To better understand this example, make sure you have knowledge of the following tutorials:-

Source Code:

The output of the above program is:-

Input first number: 15
Input second number: 6
sum = 21.0
subtraction = 9.0
product = 90.0
division = 2.5
Modulus = 6.0
Exponential = 470184984576.0
In this program, the user input is taken using input() function which takes input as a string. But as we are doing the calculation part, we need the input to be in float. So, we did the type-conversion using float() function.
The input from the user is taken as a and b and basic operations are performed and result id displayed using print with the formatting of the data.
SHARE Python program to use arithmetic operators for carrying out simple operations

You may also like...

Leave a Reply

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

Share