HARD TRUTH #1: Recursive algorithms: you have to learn them.
@marythought pretty often, unfortunately! recursive algorithms are important.
— Global Ghost Team™ (@vogon) February 8, 2015
Colin is a bad-ass programmer and when I questioned the relevance of this Python McNugget quiz question he shot down my hope that the question was an outlier. You can google for more, and here is Colin’s proof that 43 is the highest possible “non-McNugget number,” if you are interested: click me for McProof.
In a nutshell, recursive algorithms look like this:
def recurPower(base, exp): //this defines a function 'recurPower' that takes in two numbers and returns base^exp if exp == 0: return 1 elif exp == 1: return base else: return base * recurPower(base, exp-1)
It’s tricky to conceptualize the idea of using a function *while defining that function* but that’s how recursive algorithms work. This one is about the simplest they get, it’s all downhill from here.
HARD TRUTH #2: Programing == Math.
I will admit to purposefully not turning in this week’s Python assignment about looking at programs and analyzing them for efficiency and efficiency’s opposite, complexity. An example is: how many steps will it take the computer to execute this program? And while it would be lovely to be able to answer “1” or “42,” the answer is usually something more like “5⋅log2(n)+2008.”
Complexity impacts run-time and memory usage, all stuff that programmers need to care about, I suppose. Conceptually, I can understand that a more efficient program is going to mean the difference between your lightning fast web application beating out the slower competition. But as I’m still learning, I skimmed over this lesson thinking: “This is advanced math stuff and it’s tripping me up. I’ll skip this for now. I need to get programs consistently running first, and then I’ll worry about how efficient they are.”
And then look what pops up in the latest Code Fellows lesson:
Yeeeah. Hello, complexity. And do you see that lovely red bar of lowest complexity… what does that say? That’s a log function, friends. That’s MATH.
So, ok. Not to worry. One step at a time. The last hard truth is personal to me, but here it is:
HARD TRUTH #3: Do not go gentle down that web development path.
So, what now?
Make programs. Get them working. Get registered for the Foundations II Python Course. Make more programs. Make websites. Look at job descriptions and figure out what jobs/skills are connected to programming with Python (learn git), learn those skills and find people in those jobs.
…And plan the honeymoon, because that’s important too. 😀
Programmers: what hard truths did you learn early (or late) in your careers? Share ’em in the comments!
February 20, 2015 at 6:36 am
Data science – hooray!