Multiplication Table in Python Using Recursion

Recursion is the most challenging part even for the senior developer today. Recursion means calling again and again. So, here we will write a function that will keep on itself until the condition is met i.e. till the counter reaches 10.

In recursion, we don’t use loops like for loop or while loop. It’s the core logic that invokes the function until a condition. There is no definite rule for writing recursive functions. Hence you have to give a lot of focus while writing recursive functions in python. The recursive function becomes an infinite loop even with the smallest mistake. Make sure to double-check your code.

If you want to see all the practice examples and Explanations of Python, then please use this reference to this URL. 

Read More About Python Practice Series

Print Multiplication Table in Python Using Recursive Function

def rec_multiplication(num,count):
  if( count < 11):
     print(num," * ",count," = ",num * count)
     return rec_multiplication(num,count + 1)
  else:
    return 1

n = int(input("Enter any Number  :"));
rec_multiplication(n,1)
Output :
Enter any Number  :67
67  *  1  =  67
67  *  2  =  134
67  *  3  =  201
67  *  4  =  268
67  *  5  =  335
67  *  6  =  402
67  *  7  =  469
67  *  8  =  536
67  *  9  =  603
67  *  10  =  670

Also, Check Multiplication Tables in Python Using Function

Also, Check the Multiplication Table in Python Using the While Loop

Also, Check the Multiplication Table in Python Using For Loop

Look at the code above. You will see there are no loops. Just a condition inside a function. If the condition is true, the function calls it. If you mess with the condition, your function will keep on running till infinity.

About The Author