Email: Password:       Forgot Password 
    .netCodeSG
A Saarsha Group Online Community for dot net codes group like C#, Asp.NET, VB.NET, Sharepoint, JavaScript, JQuery, Ajax, SQL, WCF, WPF.
 
TECHNOLOGIES:
 

Python - Performing Arithmetic Operations

Article:
Viewed:  717 
Posted On:  23/05/2015 23:54:39 
In this article I am going to explain how to use arithmatic operations in Python... 

 

 Here I am going to explain how we can perform arithmetic operations in Python. I am going to show addition, subtraction, multiplication & divide here.

Step 1: Open IDLE(Python GUI) in your system.

Step 2 : Type the below code and save the code Eg:- I have saved with arithmetic.py name.

a = input("Enter value: ")
b = input("Enter another value : ")

c = float(a) + float(b)
d = float(a) - float(b)
e = float(a) * float(b)
f = float(a) / float(b)

print("sum is ",c)
print("substraction is ",d)
print("multiplication is ",e)
print("division is ",f)

  
Step 3 :
 Open command prompt.

Step 4 : Go to the saved script folder.

Step 5 : Write python <Script name>.py  for execution.(Eg.- python arithmatic.py)

 

1.png

Image 1.

  Comment:
         HOME   |   Submit Article   |   Contact Us   |   About Us   |   Terms & Condition   |   Advertise With us