I knew that it was necessary to resolve inner parentheses before moving on to the next inner set of parentheses as just a giant composed function, but once I got to the non-commutative operations (ie, subtraction and division, in which order of operation matters) I flubbed it up a bit, and came up with a different answer than when I ran the program. Then I examined it a bit, and with a bit more analysis (that’s an overly heady word for it, ha ha!) in the form of the following:
In this lesson, Mr Shaw introduces the idea of creating one’s own functions. Fortunately, I have plenty of experience with this and this exercise fazed me not much at all. It takes a moment to get my bearings considering what gets passed through to the defined functions, but it’s really not bad overall. I do see the difference again between Pythons 3.3 and 2.7 again, though, in the way that the arguments are inserted in a print statement via the %r rather than just exiting briefly out of what is being printed and just throwing the variable.
3.3 (what I am used to):
print(“The variable goes here:”, variablename,”.”)
print “The variable goes here: %r.” %variablename
Passing the parameters from the command line as arguments into the defined functions seems to make sense! **(Edit: nothing is passed from the command line to run the program, here. The arguments are defined within the program, not without.) Since a function just does whatever you tell it to (I suppose the same could be said of literally anything you punch into a future program), its structure and formatting does not elude me, especially since we made lots of them when I was knee-deep in 3.3.
And how exciting! He has a big red warning, “don’t worry if you are confused,” well, I am not! Yay! I know I will keep having other troubles down the line, but this one is pretty ok!
The Common Student Questions area advises me to try to break if it I seem bored 🙂 so that is what I did! I passed an argument into a function without using it in that newly defined function, and it wigged out – perfect! I don’t think 3.3 cared if you used the parameter/arg/var passed in, but 2.7 does, and that is sensible and easy to synthesize.