id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

gaurav1780@gmail.com 07_recursion > multiply_recursive
prev  |  next  |  chance

Using the following mathematical fact, a * b = a * (b - 1) + a define a recursive function that when passed two integers, returns their product without using the * operator or any loops.


multiply_recursive(10, 50) → 500
multiply_recursive(25, 25) → 625
multiply_recursive(20, 0) → 0

...Save, Compile, Run (ctrl-enter)

def multiply_recursive(a, b):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 3 Post-solution available

Copyright Nick Parlante 2017 - privacy