Background: I was sent a coding challenge via Codility, and before diving into the (timed) test, I spent some time working on the demo. I won’t be sharing the actual code challenge, but the demo is fair game to discuss, it’s featured in a public blog post. It took me a few tries, but in a nutshell, I went from 17 points out of 100 (incorrect answer) to 64 points (mostly correct answers, complexity too high), to … well, I’m going to make you read all the way through to find out.
Personal update: Josh and I signed a mountain of paperwork yesterday and are just waiting… waiting…for JUST GOT final notification that we’ve closed on a house here in Seattle. This process has been nail-biting right up until very end. I sold my house in Houston back in October and we were outbid on a house in Seattle earlier this winter. That turned out to be a blessing because it enabled me to leave my job and for us to still qualify for a (smaller) loan on Josh’s income alone. All in all, we’ll be paying half as much each month on our mortgage as we’re currently paying in rent, and moving from a land of faceless high-rise condos to a wonderfully diverse neighborhood with an invested community. Anyway, the house buying process is a lot different from 2010, when I bought my house in Houston. More paperwork, more disclosures, and more “we’re all set just waiting on this oooooone little make-or-break thing….” It may sounds nuts but trust me that rent here is no joke, and *buying a house* is going to *save us money* in both the short and long-term. Crazy, I know.
So, that’s been taking up a lot of my time and mental energy. But we’re excited!!
No new work to share… but elsewhere online, here’s some stuff I’m paying attention to: Continue reading
HARD TRUTH #1: Recursive algorithms: you have to learn them.
@marythought pretty often, unfortunately! recursive algorithms are important.
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:
elif exp == 1:
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!