Page 193 - Computer Science Class 11 With Functions
P. 193
ign8.4c:nReturnnvaluen(100.00):njuotnbeforenthenreturnnotatementnionexecutedn
Whennthenreturnnotatementnionexecuted,nthenexecutonnofnthenfunctonncomeontonendnandnPythonnreturnonthencontroln
tonlinen26,nandnthenexecutonnofnthenaooignmentnotatementnaooignonthenvaluen100.0njuotnreturnednbynthenfunctonn
interest() (oeen ign8.4d).n inally,nthenexecutonnofnlinen27nprintonthenfollowingnvaluenofnsimpleInterest,nandn
thenexecutonnofnthenprogramncompleteo.
Simple Interest: 100.0
ign8.4d:Executonnofnthenaooignmentnotatementn(linen26)ncompleteonaonfunctonninterest()nreturnonvaluen100ntonthencaller.
WhennProgramninterest.pynionexecutedninnthenPython'onIDLEnenvironment,nthendefinitonnofnthenfunctonnbecomeon
interest() becomeonavailablenfornuoeninnthenPythonnohell,nandnwencanninvokenitndirectlynaonohownnbelow:
>>> interest(1000, 5, 2)
100.0
Function Call: Used to invoke a function, using its name, followed by the arguments (if any) in parentheses.
Formal Parameters: Variables that receive the values during a call to the function.
Input Arguments: Input values passed during the call to a function
SuppooenwenwiohntoncomputenoimplenintereotnfornthenprincipalnamountnofnRo.n1000,nraten5%nandntmen2nyearo.nThen
executonnofnthenfunctonnbeginonbyntranoferringnthencontrolntonlinen1,nandnthenargumenton1000, 5, 2 arentonben
paooedntonthenfunctonninterest().nSkippingnnon-executablenmult-linencomment,nexecutonnofnlinen10ncomputeon
thenoimplenintereot,nandnlinen11nreturnonthenvaluenofnsimpleInterestntonthencallern(Pythonnohellninnthioncaoe,noeen
ign8.5),nwhichndioplayonthenvaluenreturnednbynthenfunctonninterest().
Introductonnton unctono 191

