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>Thanks guys, i figured it out!!!
i had to return 0 instead of 1, otherwise the answer would always be one higher than what we wanted.
and i understand how you have to call upon the function, which is the main thing i missed.
Here's what i did:</p>

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

python recursion