Page 62 - Computer Genius Class 07
P. 62

Well done, you have learned to check if the number is Even or Odd!





                  You can view the code of the above program in ‘Python’ by selecting ‘Python’ as an Editor.














                  What Exactly are Functions?

                  A  unction is a  loc  o  code  hich is made up o  a set o  steps that result in a single specific action.
                  The  programmer   ill  gi e  a  simple  name  to  this  specific   unction   as  gi ing  a  simple  name  to  a
                  function, increases the chances that the set of steps can be easily reused again and again in the
                  program.

                  Function Parameters

                  Function parameters are variables local to the function, taken as input to do a task when the function
                  is called and are part o  the definition. Arguments are the  alues that are passed on to the  unction
                  received by the function as a parameter. A function can have more than one parameter, and in this
                  case order in which arguments are passed matters.
                  So  Function parameters are the names listed in the  unction definition and Function arguments are
                  the real values passed to (and received by) the function.

                  Example:
                  To calculate the volume (V) of a cuboid, you need three variables length (L), breadth (B) and height
                  (H). The formula to calculate the volume of a cuboid is V = L * B * H.


                      60     Computer Genius-VII
   57   58   59   60   61   62   63   64   65   66   67