Open study

is now brainly

With Brainly you can:

  • Get homework help from millions of students and moderators
  • Learn how to solve problems with step-by-step explanations
  • Share your knowledge and earn points by helping other students
  • Learn anywhere, anytime with the Brainly app!

A community for students.

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?

MIT 6.189 A Gentle Introduction to Programming Using Python (OCW)
I got my questions answered at in under 10 minutes. Go to now for free help!
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Join Brainly to access

this expert answer


To see the expert answer you'll need to create a free account at Brainly

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.
@Screech Yeah, that looks like the goods. Thanks for capturing!
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?

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

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

Not the answer you are looking for?

Search for more explanations.

Ask your own question