Page 210 - Computer Science V2.0 Class 11
P. 210
5. max(<sequence>) Returns the largest argument >>> lst=[3, -2, 0, 78, 25]
from a list, tuple, or >>> max(lst)
or
sequence of arguments. 78
max(<val1,val2,...,valn>)
>>> max(2,0,-4,19,36,8)
36
>>> max((6, 7, 4))
7
>>> max(59, 80, 95.6, 95.2)
95.6
6. min(<sequence>) Returns the smallest >>> lst=[3, -2, 0, 78, 25]
or argument from a list, tuple, >>> min(lst)
or sequence of arguments. -2
min(<val1,val2,...,valn>)
>>> min(2,0,-4,19,36,8)
-4
>>> min((6, 7, 4))
4
>>> min(59, 80, 95.6, 95.2)
59
7. divmod(<num1,num2>) Returns a tuple comprising >>> divmod(17,4)
Quotient and remainder when (4, 1)
num1 is divided by num2. >>> divmod(-21,5)
(-5, 4)
8. sum(<sequence [,num2]>) Returns sum of all numeric >>> lst =[1, 3, 5, 7]
values in the given input >>> sum(lst)
sequence. Optional input 16
num2, when provided, is >>> sum(lst,5)
added to the sum of elements 21
of the sequence. >>> sum((1, 3, 5, 7))
16
9. abs(num) Absolute value of integer, >>> abs(-12)
floating-point, or complex 12
number. >>> abs(-14.7)
14.7
>>> abs(21)
21
>>> abs(4+3j)
5.0
10. pow(num1, num2[,num3]) Returns num1 raised >>> pow(14, 3)
to the power of num2. 2744
Optional input, num3, >>> pow(3, 4, 5)
when provided, is used for 1
computation as follows: >>> pow(-2.3, 5)
-64.36342999999998
(num1**num2)%num3
>>> pow(2, 5, 3)
2
196 Touchpad Computer Science (Ver. 2.0)-XI

