MOOC-E 2 years ago 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?

1. Screech

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.

2. MOOC-E

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

3. JohnM

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?

4. Screech

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)

5. JohnM

6. MOOC-E

@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!

Find more explanations on OpenStudy