Calculation in Python

We can perform all types of calculation and Comparison in Python.

Expression are used to perform calculations in Python.

Expression – Combination of  Numbers and Operator. Operator Decides the type of calculation performed by the Expression.
Example: 3+4=7

Types of Operator:

  1. Arithmetic Operator
  2. Comparison Operator
  3. Logical Operator

Arithmetic Operator – Performs the simple Mathematical Calculation.

# Accept nos from user and find its sum
x=int(input(‘Enter a number : ‘))
y=int(input(‘Enter a number1 : ‘))

#adding nos
sum=x+y

#print output
print(‘Sum is =’, sum)

Like Addition, Subtraction, Multiplication and Division can be performed.

Win Corporate Training
website: http://www.wincorptrg.com
View My Profile

Advertisements