Page 216 - Computer Science V2.0 Class 11
P. 216
Fig 8.3a: Python notes of the definition of the function triangle()
Next, Python encounters the definitions of function rhombus() (lines 12–24) in the global frame and makes a note
of the function definition, as shown in Fig 8.3b.
Fig 8.3b: Python notes of the definition of the function rhombus().
● The Lines 25–30, are for documentation purposes and are ignored by the Python interpreter.
● In Line 31, the red arrow indicates the line to be executed next. On execution of line 31, the program makes a call
to the function triangle().
● As mentioned earlier, a call to a function is also known as invoking the function. So, instead of saying that the
program calls the function triangle(), we can say that the program invokes the function triangle(). Thus,
the control is transferred to line 1 of Program 8.2b where the definition of the function triangle() begins.
● As the function triangle() is called from the global frame, we say that the global frame is the caller and the
function triangle() is the callee.
● Note that a call to the function triangle() comprises the name of the function, followed by a pair of parentheses.
● Lines 2–6 in the function triangle() are for documentation purpose.
● On execution of Lines 07–11, print the triangle as depicted in Fig 8.3c.
● So far we have used several built-in functions such as abs(), type(), and divmod() which return a value.
However, in the absence of any specific value being returned, the function returns None (see Fig 8.3d)
202 Touchpad Computer Science (Ver. 2.0)-XI

