Page 195 - Computer Science Class 11 With Functions
P. 195
Ø n Thenprogram/functionnthatncallonanfunctionnioncallednfunctionncaller.nThencallednfunctionnionncallednthencalleen
function.nn
Ø n Anfunctionnmaynhave:n
n n nonargumentnandnnonreturnnvalue
n n argument(o)nbutnnonreturnnvalue
n n argument(o)naonwellnaonreturnnvalue
Ø n Anfunctionnmuotnbendefinednbeforenitnioncalled.nIfnthenfunctionncallnprecedeonthenfunctionndefinition,nPythonn
interpreternwillnpointnoutnannerror.n
Ø n Whenntheninterpreternencounteronthenfunctionndefinitionn(defnotatemento),nthenotatement(o)ninnthenfunctionn
bodynion(are)nnotnexecutednatnthatntime.nPythonnonlynmakeonannotenofnthenfunctionndefinition.n
Ø n Anfunctionnionexecutednonlynwhennitnioncalled.nWhennanfunctionnioncalled,nthencontrolnohiftontonthenfirotnotatementn
ofnthenfunctionnbody.n
Ø n Whennthencontrolnreacheonthenendnofnthenfunctionnbody,nornanreturnnotatementnionencountered,nthencontroln
returnontonthenpointnfromnwherenthenfunctionnwaoncalled.n
Ø n Somencommonlynuoednbuilt-innfunctiononarenilluotratedninnthenfollowingntable:
S. No. Function Description Examples
1. print(<data object>) Outputon then valuen ofn ann >>> print('Hello')
expreooionnpaooedntonitnaon Hello
anninput. >>> print(2+14)
16
2. input(<display message>) Readonanninputntextnfromn >>> name = input('Enter name:')
thenuoernuntlnannewlinenion Enter a name: Python
encounterednandnreturnon >>> print(name)
itn aon an otringn withoutn Python
evaluatngnitonvalue.
3. int(value), Inputnargumentn >>> int('234')
float(value), str(value) convertedntoninteger,n 234
floatngnpointnandnotringn >>> str(234)
valuenreopectvely. '234'
>>> float('234.50')
234.5
>>> int(234.60)
234
4. eval(<string>) Evaluateontheninputn >>> eval('15+10')
argumentnandnreturnon 25
thenreoultnofnevaluaton.
5. max(<sequence>) Returnonthenlargeotn >>> lst=[3, -2, 0, 78, 25]
or argumentnfromnanliot,n >>> max(lst)
tuple,nornoequencenofn 78
max(<val1,val2,...,valn>)
argumento. >>> max(2,0,-4,19,36,8)
36
>>> max((6, 7, 4))
7
>>> max(59, 80, 95.6, 95.2)
95.6
Introductonnton unctono 193

