ASSINGMENT: DATA SCIENCE
PYTHON MATH
Submitted by :ASIF ARSHAD
To:
SIR Dr.Aamir Shahzad sahib
PYTHON MATHS
1-Built –in Math Functions:
The min() and max() functions can be used to find the lowest or highest value in an iterable.
Examples:
Input Output
1:- x= min(12,09,54)
print(x) 09
2:- y= max(12,09,54)
Print(y) 54
2-Absolute Value:
Distance from zero or origin to that number, absolute value always positive value. The abs() return positive
value. Example:
Input Output
x=abs(-9) 9
print(x)
3-Power:
The number of times a number is used as factor in multiplication problem.
The pow(x,y) function returns the value of x to the power of y (x^y). Example:
Input Output
x=pow (7,3) 343
print(x)
4-The Math Module:
Python has also a built in module called math , which extends the list of mathematics functions.
math.sqrt() return square root of the number. Example:
Input Output
import math 9
x = math.sqrt(81)
print(x)
5-Ceiling and floor Integers:
Ceiling Integers: Round a number upward to its nearest integer.
Floor Integers: Round a number downward to its nearest integer
Input Output
x = math.ceil(5.4) 6
print(x)
y = math.floor(5.4) 5
print(y)
math.pi constant ,return the value of pi
import math
x=math.pi
print(x) --------------------------🡪 3.141592653589793
Data Types
Numerical Categorical Ordinal
Data are numbers,and can be split into two Data are value that cannot be measured up Data like categorical data ,but can be
categories. against each other . Example: measured up against each other.Example:
(i) Discrete Data: counted data Colour value,or any yes/no value School grade where A is better then B.
that are limited to integers.
(ii) Continuous Data: measure
data that can be any number.