Page 189 - Computer Science Class 11 With Functions
P. 189
Next,nPythonnencounteronthendefinitononofnfunctonnrhombus()n(lineon12-24)ninnthenglobalnframenandnmakeonannoten
ofnthenfunctonndefiniton,naonohownninn ign8.3b.
ign8.3b:nPythonnnoteonofnthendefinitonnofnthenfunctonnrhombus().
● nThenLineon25-30,narenforndocumentatonnpurpooeonandnarenignorednbynthenPythonninterpreter.
● nInnLinen31,nthenrednarrownindicateonthenlinentonbenexecutednnext.nOnnexecutonnofnlinen31,nthenprogramnmakeonancalln
tonthenfunctonntriangle().n
● nAonmentonednearlier,nancallntonanfunctonnionaloonknownnaoninvokingnthenfuncton.nSo,ninoteadnofnoayingnthatnthen
programncallonthenfunctonntriangle(),nwencannoaynthatnthenprogramninvokeonthenfunctonntriangle().nThuo,n
thencontrolniontranoferredntonlinen1nofnProgramn8.2bnwherenthendefinitonnofnthenfunctonntriangle()nbegino.
● nAonthenfunctonntriangle()nioncallednfromnthenglobalnframe,nwenoaynthatnthenglobalnframenionthencallernandnthen
functonntriangle()nionthencallee.
● nNotenthatnancallntonthenfunctonntriangle()ncomprioeonthennamenofnthenfuncton,nfollowednbynanpairnofnparentheoeo.
● nLineon2-6ninnthenfunctonntriangle()narenforndocumentatonnpurpooe.nn
● nOnnexecutonnofnLineon07-11,nprintnthentrianglenaondepictedninn ign8.3c.n
● nSonfarnwenhavenuoednoeveralnbuilt-innfunctononouchnaonabs(),ntype(),nandndivmod()nwhichnreturnnanvalue.n
However,ninnthenaboencenofnanynnopecificnvaluenbeingnreturned,nthenfunctonnreturnonNonen(oeen ign8.3d)n
ign8.3c:nPythonnprintonantrianglenonnthenexecutonnofnthenfunctonntriangle()
Introductonnton unctono 187

