[Tutor] Re:-Recursive Functions

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Sun Jun 1 23:24:02 2003


> i got taht right too but using while loop if u ask me to do it again
> using recursive function i will not be able.

Hi Evripides,

Ok, I'm now not so certain that we're using the same definition for the
word "recursive", and that worries me.  Well, to tell the truth, I'm
actually a little frustrated with myself, because I'm not quite sure why
we are miscommunicating.  We have to get at the bottom of this.


> # we have the word house we can find the last character like taht:
> word = "house"
> length = len(word)
> lastLetter = word[length - 1]
> print lastLetter

This is nice... but this really has nothing to do with what we talked
about in our last message.  Well, it does use the len() function, but
that's really way off tangent.


The question I asked last message was to see if you could try writing a
function that would do the work that the len()  function does.
Specifically: there's a difference between using len() and implementing
len(), and I wanted to see how you'd implement len().  But that didn't
work; you ignored that part of the message.


Ok, let's try something else.  A while back, you said:

> i understand what a recursive function does. the problem im facing is to
> apply it on my problem here what i have right now and let me know if i
> am in the rigth direction ok

Out of the risk of being bluntly rude, I need to ask for reassurrance.
Can you show us a particular example of a recursive function that you've
seen before?  In your own words, what does a recursive function do?

Show us what you think a "recursive" defintion means.  And not just
abstract definitions: show us a concrete example of a recursive function
that you've seen.

You have to understand, we cannot read your mind.  We need some kind of
background on what you know --- we won't treat you as a sponge or a blank
slate.  From what you've written, we have a pretty good idea that you know
about loops and how to do variable assignments.  That's a good start: now
show us more about what you mean when you say "recursion".