Data Handling CH - 4
Data Handling CH - 4
Data Handling CH - 4
Data Handling
operators..
1. Arithmetic operators – Arithmetic operators uses by
Python for basic calculations. It requires two valaus
(operands) to calculate.
Additon, multiplication, division substraction, remainder,
exponentiation, floor division.
2. Unary operators – The operators that act on one
operand are referred to as Unary operators.
Unary - and Unary +
3. Binary Operators – Operators that act upon two
operands are referred to as binary Operators.
4. Relational Operators – Relational operators determine
the relation among different operands. Python provide
six relational operators for comparing values.
< less than, <= less than or equal to, == equal to >
greater than, >= greator than or equal to , != not
equal to
5. Identity operators – There are two identity operators in
Python (is and is not) . The identity operators are used
to check if both the operands reference the same object
memory, Identity operators compare the memory
locations of two objects and return True or False
accordingly.
Operator Description
() Parentheses
** Exponentiation
+x, - x Positive, Negagive
( unary +, - )
*,/,//,%, +, - Multiplication,
Division, Floor division,
remainder, addition,
Substracation
< , <= , > , Comparision, identity
>= , operators
<>, != ,
== . is , is
not
Not x Boolean NOT
and Boolean AND
or Boolean OR
Python will evaluate the operator with higher precedence
first. But if the expression contains two operators that have
the same precedence? That time it determine the order of
operators.
#(cos x / ten x) +x
import math
(math.cos(x)/math.tan(x))+x
import math
r=7.5
area=math.pi*r*r
volume=4*math.pi*math.pow(r,3)
print("radius of the sphere : ", r, "Meters")
print("Area of the sphere : ", area, "Units square ")
print ("Volume of the sphere :" , volume, "Units Cube")