ES Lecture 2
ES Lecture 2
atan2(y, x, /)
Return the arc tangent (measured in
radians) of y/x.
atanh(x, /)
Return the inverse hyperbolic
tangent of x.
ceil(x, /)
Return the ceiling of x as an
Integral.
comb(n, k, /)
Number of ways to choose k items
from n items without repetition and without
order.
1
Evaluates to n! / (k! * (n - k)!)
when k <= n and evaluates
to zero when k > n.
copysign(x, y, /)
Return a float with the magnitude
(absolute value) of x but the sign of y.
cos(x, /)
Return the cosine of x (measured in
radians).
cosh(x, /)
Return the hyperbolic cosine of x.
2
degrees(x, /)
Convert angle x from radians to
degrees.
dist(p, q, /)
Return the Euclidean distance
between two points p and q.
erf(x, /)
Error function at x.
erfc(x, /)
Complementary error function at x.
exp(x, /)
Return e raised to the power of x.
expm1(x, /)
Return exp(x)-1.
3
This function avoids the loss of
precision involved in the direct evaluation
of exp(x)-1 for small x.
fabs(x, /)
Return the absolute value of the
float x.
factorial(x, /)
Find x!.
floor(x, /)
Return the floor of x as an
Integral.
fmod(x, y, /)
Return fmod(x, y), according to
platform C.
x % y may differ.
frexp(x, /)
Return the mantissa and exponent of
4
x, as pair (m, e).
fsum(seq, /)
Return an accurate floating point
sum of values in the iterable seq.
gamma(x, /)
Gamma function at x.
gcd(*integers)
Greatest Common Divisor.
hypot(...)
hypot(*coordinates) -> value
isclose(a, b, *, rel_tol=1e-09,
abs_tol=0.0)
Determine whether two floating point
numbers are close in value.
rel_tol
maximum difference for being
considered "close", relative to the
magnitude of the input values
abs_tol
maximum difference for being
considered "close", regardless of the
magnitude of the input values
6
For the values to be considered
close, the difference between them
must be smaller than at least one of
the tolerances.
isfinite(x, /)
Return True if x is neither an
infinity nor a NaN, and False otherwise.
isinf(x, /)
Return True if x is a positive or
negative infinity, and False otherwise.
isnan(x, /)
Return True if x is a NaN (not a
number), and False otherwise.
isqrt(n, /)
Return the integer part of the
square root of the input.
lcm(*integers)
Least Common Multiple.
7
ldexp(x, i, /)
Return x * (2**i).
lgamma(x, /)
Natural logarithm of absolute value
of Gamma function at x.
log(...)
log(x, [base=math.e])
Return the logarithm of x to the
given base.
log10(x, /)
Return the base 10 logarithm of x.
log1p(x, /)
Return the natural logarithm of 1+x
(base e).
8
log2(x, /)
Return the base 2 logarithm of x.
modf(x, /)
Return the fractional and integer
parts of x.
nextafter(x, y, /)
Return the next floating-point value
after x towards y.
perm(n, k=None, /)
Number of ways to choose k items
from n items without repetition and with
order.
pow(x, y, /)
Return x**y (x to the power of y).
prod(iterable, /, *, start=1)
Calculate the product of all the
elements in the input iterable.
radians(x, /)
Convert angle x from degrees to
radians.
remainder(x, y, /)
Difference between x and the closest
integer multiple of y.
sin(x, /)
Return the sine of x (measured in
radians).
sinh(x, /)
Return the hyperbolic sine of x.
sqrt(x, /)
Return the square root of x.
tan(x, /)
Return the tangent of x (measured in
radians).
tanh(x, /)
Return the hyperbolic tangent of x.
trunc(x, /)
Truncates the Real x to the nearest
Integral toward 0.
ulp(x, /)
11
Return the value of the least
significant bit of the float x.
DATA
e = 2.718281828459045
inf = inf
nan = nan
pi = 3.141592653589793
tau = 6.283185307179586
FILE
(built-in)
In [165]: math.factorial(5)
Out[165]: 120
In [166]: math.sin(4)
Out[166]: -0.7568024953079282
In [168]: factorial(8)
Out[168]: 40320
In [169]: sin(2)
Traceback (most recent call last):
12
File "C:
\Users\amajid\AppData\Local\Temp\ipykernel_5
088\76962824.py", line 1, in <module>
sin(2)
In [171]: sin(3)
Out[171]: 0.1411200080598672
In [172]: help(math.sin)
Help on built-in function sin in module
math:
sin(x, /)
Return the sine of x (measured in
radians).
In [173]:
In [174]: Age=30
In [175]: print(Age)
13
30
In [176]: print('Age')
Age
In [178]: Name='Ali'
14
In [185]: runfile('C:/Users/amajid/
Documents/DataScience/Essentials of Data
Analytics/EDA_2024/untitled5.py', wdir='C:/
Users/amajid/Documents/DataScience/
Essentials of Data Analytics/EDA_2024')
My name is Ali and my age is 30
In [186]: runfile('C:/Users/amajid/
Documents/DataScience/Essentials of Data
Analytics/EDA_2024/untitled5.py', wdir='C:/
Users/amajid/Documents/DataScience/
Essentials of Data Analytics/EDA_2024')
My name is Ahmad and my age is 30
In [187]: runfile('C:/Users/amajid/
Documents/DataScience/Essentials of Data
Analytics/EDA_2024/untitled5.py', wdir='C:/
Users/amajid/Documents/DataScience/
Essentials of Data Analytics/EDA_2024')
My name is Ahmad and my age is 30
done!
In [191]: runfile('C:/Users/amajid/
Documents/DataScience/Essentials of Data
Analytics/EDA_2024/untitled5.py', wdir='C:/
Users/amajid/Documents/DataScience/
Essentials of Data Analytics/EDA_2024')
My name is Ahmad and my age is 30
done!
In [192]: runfile('C:/Users/amajid/
Documents/DataScience/Essentials of Data
Analytics/EDA_2024/untitled5.py', wdir='C:/
Users/amajid/Documents/DataScience/
Essentials of Data Analytics/EDA_2024')
My name is Ahmad and my age is 30done!
In [193]: runfile('C:/Users/amajid/
Documents/DataScience/Essentials of Data
Analytics/EDA_2024/untitled5.py', wdir='C:/
Users/amajid/Documents/DataScience/
Essentials of Data Analytics/EDA_2024')
My name is Ahmad and my age is 30 done!
16
In [194]: 2*'a'
Out[194]: 'aa'
In [195]: 'a'+'b'
Out[195]: 'ab'
In [196]: 'a'+2
Traceback (most recent call last):
File "C:
\Users\amajid\AppData\Local\Temp\ipykernel_5
088\197187164.py", line 1, in <module>
'a'+2
In [197]: 3*'ab'
Out[197]: 'ababab'
In [197]:
In [198]: print('*'*20)
********************
In [199]: runfile('C:/Users/amajid/
Documents/DataScience/Essentials of Data
Analytics/EDA_2024/untitled5.py', wdir='C:/
17
Users/amajid/Documents/DataScience/
Essentials of Data Analytics/EDA_2024')
********************
In [200]: runfile('C:/Users/amajid/
Documents/DataScience/Essentials of Data
Analytics/EDA_2024/untitled5.py', wdir='C:/
Users/amajid/Documents/DataScience/
Essentials of Data Analytics/EDA_2024')
********************
********************
********************
********************
In [201]: runfile('C:/Users/amajid/
Documents/DataScience/Essentials of Data
Analytics/EDA_2024/untitled5.py', wdir='C:/
Users/amajid/Documents/DataScience/
Essentials of Data Analytics/EDA_2024')
********************************************
************************************
In [202]: runfile('C:/Users/amajid/
Documents/DataScience/Essentials of Data
Analytics/EDA_2024/untitled5.py', wdir='C:/
Users/amajid/Documents/DataScience/
Essentials of Data Analytics/EDA_2024')
********************
********************
18
********************
********************
In [203]: runfile('C:/Users/amajid/
Documents/DataScience/Essentials of Data
Analytics/EDA_2024/untitled5.py', wdir='C:/
Users/amajid/Documents/DataScience/
Essentials of Data Analytics/EDA_2024')
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
19
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
20
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
21
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
In [204]:
22