Mathematical Operators- Python

By: Dynasty William

What is an Operator?

• Operators are the constructs which can manipulate the value of operands(operand~the quantity on which an operation is to be done.)
*****************************************************************

Ex.) Consider the expression 4 + 5 = 9. Here, 4 and 5 are called operands and + is called operator.

Different Kinds Operators

If a variable is included in a number calculation you should remember:

• Variables go on the left side of the operator
• Calculation goes on the right of the operator
EX.) 3 * x

Subtraction(-):

x = 4

y = 5

z = 6

print x - z

Output- -2

***************************************************************

Multiplication(*):

x = 4

y = 5

z = 6

print z * 3

Output- 18

***************************************************************

x = 4

y = 5

z = 6

print x + y

Output- 9

Division(/):

x = 4

y = 5

z = 6

print z / x

Output- 1

Modulus(%):

x = 4

y = 5

z = 6

print z % y

Output- 1

***************************************************************

Negative number(-x):

x = 4

y = 5

z = 6

print -x

Output- -4

***************************************************************

Exponent(**):

x = 4

y = 5

z = 6

print y ** x

Output- 625

Share it on social medias
Share it on social medias

• Click on the Export button below
• A window should pop up
• Click on the Change button on the left sidebar
• Select Save as PDF
• Click on Save

• Click on the Export button below
• A window should pop up
• Click on the Change button on the left sidebar
• Select Save as PDF
• Click on Save

New presentation

by dynastywilliam

18 views

Public - 10/17/16, 6:02 PM