Ask your own question, for FREE!
MIT 6.189 A Gentle Introduction to Programming Using Python (OCW) 15 Online
OpenStudy (anonymous):

The Mystery of the Missing Code: At about minute 20 of lecture 6 in 6.00SC (which is part of the week 5 assignment of the Mechanical MOOC course), Professor Grimson throws in two examples of code for recursive definitions that are not included in the downloadable code file. Has anyone out there recreated this code, and if so, can you share out?

OpenStudy (anonymous):

Went to look at lecture 6. The code display is almost illegible. I zoomed in and the first looks like def simpleExp(b, n): if n == 0: return 1 else: return n * simpleExp( b, n-1) and a few minutes later in the lecture after his demonstration with the stacking toy, he presents the Hanoi function def Hanoi(n, f, t, s): if n == 1: print "Move from " + f + " to " + t else: Hanoi( n-1, f, s, t ) Hanoi( 1, f, t, s) Hanoi( n-1, s, t, f ) I haven't coded or tested this but it seems to fit with what he presented and make sense logically. Was this what you wanted? Yeah it can be a real eyestrain trying to make out that fuzzy video sometimes.

OpenStudy (anonymous):

@Screech Yeah, that looks like the goods. Thanks for capturing!

OpenStudy (anonymous):

What is a) the point of simpleExp and b) what is it doing (specifically, n * simpleExp( b, n-1)? If I plug in b=4, n=3 I sort of see that it's moving through 3 x 2 x 1 = 6. But I get output 6 whether b is 4, 44, 72 etc. and n remains 3. Ultimately b is ignored. What are we supposed to learn from this?

OpenStudy (anonymous):

How about return b * simpleExp( b, n-1) I could barely discern the letters and I made a quick guess. Might make more sense in order to raise b to the nth power (simulating b ** n)

OpenStudy (anonymous):

This is what I frustrates me about MOOC's "Gentle Python" course. Too much of how about this, how about that, with people left scratching heads. My post has been up for around 24 hours and notice that no one from MOOC has jumped in with an authoritative answer. Another substantive MIT homework question I asked about a week ago has also gone unaddressed. Yet MOOC tells us in its weekly email to send our questions to OpenStudy -- where there is no timely help with the MIT homework, at least in my experience. Meanwhile, give Codecademy credit. They have several moderators who jump in pretty quick and provided excellent direction and insight, or plain answers if you're really stuck. Plus some people who have programming experience who, though new to Python, know from past experience with Ruby or whatever how to include underlying logic in their advice.

OpenStudy (anonymous):

@JohnM Sorry to hear you aren't getting as much help as you'd like. We knew from the beginning that running a course without the direct involvement of subject matter experts was a risk, and it obviously comes up short at times. Over time, we hope we'll build a community that is larger a more responsive. In the mean time, we salute learners like @Screech who are spending a lot of their time helping others!

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!