How to multiply without the * sign using recursion?
<p>so as homework for a programming class on python we're supposed to multiply to integers (n,m) with each other WITHOUT using the * sign (or another multiplication form). We're supposed to use recursion to solve this problem, so i tried just adding n with itself, m number of times. I think my problem is with using recursion itself. I have searched on the internet for recursion usage, no results. Here is my code. Could someone point me in the right direction?</p>

<pre><code>    def mult(n,m):
        """ mult outputs the product of two integers n and m
            input: any numbers
        """
        if m &gt; 0:
            return n + n 
            return m - 1
        else:
            return 1
</code></pre>

<p>I don't want to give you the answer to your homework here so instead hopefully I can provide an example of recursion that may help you along :-). </p>

<pre><code># Here we define a normal function in python
def count_down(val):
    # Next we do some logic, in this case print the value
    print(val)

    # Now we check for some kind of "exit" condition. In our
    # case we want the value to be greater than 1. If our value 
    # is less than one we do nothing, otherwise we call ourself
    # with a new, different value.
    if val &gt; 1:
        count_down(val-1)

count_down(5)
</code></pre>

<p>How can you apply this to what you're currently working on? Maybe, instead of printing something you could have it return something instead...</p>

python recursion