This week, we delved further into Python, despite an
interruption from the symphony. This
interruption led to us concluding only one lesson in two days, namely
functions. Functions are the same as
Jeroo methods- a few lines of code that are first defined and can later be
called on multiple times. I do not,
however, understand the value of- as in our examples- putting everything in
functions and then calling the main function once; it seems unnecessarily
confusing, even if it does hold some value for error detection. Still, if it stood the test of time….
I will not go into the mechanics and syntax of how functions
work, but I will note that, unlike in Jeroo, functions can be of
variables. That is, a function can have
inputs and an output both, as well as doing something in its body whenever
called. The indent of three spaces
reappeared, symbolizing organization- an indented line might be part of a
function’s definition, etc.. Finally, we
“wrote” a program that calculated the heat index and then printed out a string
based on its numerical value.
Overall, we seem to be progressing quickly towards the parts
of Python with no Jeroo analogues. That
seems like a good thing.
No comments:
Post a Comment