Tutorial Gateway

  • C Language
  • Java
  • R
  • SQL
  • MySQL
  • Python
  • BI Tools
    • Informatica
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • QlikView
  • Js

Python Program to Perform Arithmetic Operations

by suresh

How to write a Python Program to Perform Arithmetic Operations on numeric values with practical example.

Python Program to Perform Arithmetic Operations

This python program allows the user to enter two numeric values of data type float. Next, we are going to use those two values to perform the Arithmetic Operations such as Addition, Subtraction, Multiplication,Exponent, Modulus, and Division.

# Python Program to Perform Arithmetic Operations

num1 = float(input(" Please Enter the First Value Number 1: "))
num2 = float(input(" Please Enter the Second Value Number 2: "))

# Add Two Numbers
add = num1 + num2

# Subtracting num2 from num1
sub = num1 - num2

# Multiply num1 with num2
multi = num1 * num2

# Divide num1 by num2
div = num1 / num2

# Modulus of num1 and num2
mod = num1 % num2

# Exponent of num1 and num2
expo = num1 ** num2

print("The Sum of {0} and {1} = {2}".format(num1, num2, add))
print("The Subtraction of {0} from {1} = {2}".format(num2, num1, sub))
print("The Multiplication of {0} and {1} = {2}".format(num1, num2, multi))
print("The Division of {0} and {1} = {2}".format(num1, num2, div))
print("The Modulus of {0} and {1} = {2}".format(num1, num2, mod))
print("The Exponent Value of {0} and {1} = {2}".format(num1, num2, expo))

OUTPUT

For this Python Program for Arithmetic Operations example, we assigned num1 as 10 and num2 as 3.

Python Program to Perform Arithmetic Operations 1

Placed Under: Python, Python Examples

Trending Posts

Java lastIndexOf Method

UNPIVOT in SQL

Python Program to Perform Arithmetic Operations

Python Reverse List Function

Python Program to Count Even and Odd Numbers in a List

C Program to Find Length of a String

Create Power BI Workspace

C Program to find Sum of Even and Odd Numbers in an Array

MDX FirstSibling Function

Java Program to find Sum of N Natural Numbers

  • C Programs
  • Java Programs
  • SQL FAQ’s
  • Python Programs
  • SSIS
  • Tableau
  • JavaScript

Copyright © 2019 | Tutorial Gateway· All Rights Reserved by Suresh

Home | About Us | Contact Us | Privacy Policy