You are on page 1of 3

DATA HANDLING

1. List = [elements are separated by commas]


2. Tuples = (elements are separated by commas)
3. Sets = {elements are separated by commas} ignores duplicate values
4. Dictionary = {“key” : Value separated by commas}
5. Memory address for a value = id(value)
6. Smaller case has more value than upper case
7. If a is b, then id(a) = id(b)
If a is not b, then id(a) ≠ id(b)
8. Operator Precedence

Operator Description
() Parenthesis (Grouping)
** Exponentiation
~x Bitwise nor
+x,-x Positive, negative (unary +, -)
*,/,//,% Multiplication,division ,floor division,
remainder
+,- Addition, Substraction
& Bitwise and.
^ Bitwise XOR.
l Bitwise OR
<,<=,>,>=,<>,!=,==,is,is not Comparisons (Relational operators) identity
operators
Not x Boolean NOT
And Boolean AND
or Boolean OR

9. To convert a given data type into another data type specified by the
user :
 First type, a value in ascent over variable.
 Take a new variable and assign its value to a desired data type
(previously assigned variable).
 Then print the new variable.
 Required result is obtained.
Float → integer = int()
Integer → float = float()
Number → complex number = complex()
Number boolean → string = str()
Any type → boolean = bool()
10. MATH MODULE FUNCTIONS
import math
S.NO Function Prototype Description
(General type)
1. ceil maths.ceil(num) The ceil() function returns the
smallest integer not less that
the num.
2. sqrt maths.sqrt(num) The sqrt() function returns the
square root of num. If num < 0,
domain error occurs.
3. exp maths.exp(arg) The exp() function returns the
natural logarithm e raised to
the arg power.
4. fabs maths.fabs(num) The fabs() function returns
the absolute value of the num.
5. floor maths.floor(num) The floor() function returns
the largest integer, not
greater than num.
6. log maths.log(num,[base]) The log() function returns the
natural logarithm for num.A
domain errors occurs if num is
negative and range error
occurs if argument num is 0.
7. log10 maths.log10(num) The log10() function returns
the base 10 logarithm for
num.A domain errors occurs if
num is negative and range
error occurs if argument num
is 0.
8. pow maths.pow(base,exp) The pow()unction returns base
raised to exp power i.e.base
exp. A domain error occurs if
base = 0 and exp<=0; also if
base<0 and exp is not integer
9. sin maths.sin(arg) The sin() function returns sine
of arg. The value of arg must
be in radians.
10. cos maths.cos(arg) The cos() function returns
cosine of arg. The value of arg
must be in radians
11. tan maths.tan(arg) The tan() function returns
tangent of arg. The value of
arg must be in radians
12. degrees maths.degrees(x) The degrees() converts angle x
from radians to degrees.
13. radians maths.radians(x) The radians() converts angle x
from degrees to radians .
14. pi math.pi Prints pi value
15. e math.e Prints e value

11. RANDOM MODULE FUNCTIONS


import random
 random.random(a,b) → a ≤ N < b [ in python it prints numbers
between 0.0 to 1.0 by default]
 random.randint(a,b) → a ≤ N ≤ b
 random.randrange(a,b,c) → a ≤ N < b [ result in the pattern of c ]
 random.randrange(a) → 0 to a
 random.randint((a,b)-3) → a-3 ≤ N < b-3
 random.randint((a,b)*5) → a*5 ≤ N < b*5

12. STATISTICS MODULE FUNCTIONS


import statistics
Seq = [ elements separated by commas ]
 statistics.mean(seq)
 statistics.mode(seq)
 statistics.median(seq)

You might also like