Multiplication Table in Python Using Function

(Last Updated On: 27/11/2023)

In this blog, we’ll learn about multiplication table in python using function. When using the function in any of the python programs, architecture is the biggest challenge. Architect in the sense of what part should go in function. Ideally, the function should include the same type of code which is executed again and again. This way, we reduce the compiling time and increase the coding lines.

In the example of the Multiplication Table in Python using function, the multiplication operation will be performed again and again. So we will write the “function multiply” with two input parameters. And the return parameter will be the result, just like the below code.

Program to Print Multiplication Table Using Functions

def multiply(num,count):
  return num * count

n = int(input("Enter any Number  :"));
i = 1
for i in range(1,11):
 print(n," * ",i," = ",multiply(n,i))
 i = i + 1
Output :
Enter any Number  :19
19  *  1  =  19
19  *  2  =  38
19  *  3  =  57
19  *  4  =  76
19  *  5  =  95
19  *  6  =  114
19  *  7  =  133
19  *  8  =  152
19  *  9  =  171
19  *  10  =  190

The above program is a simple program to print multiplication table in Python using Functions. Here, the user enters the input of any number of his choice. Then we write the “function” which uses “i” as a counter variable. Then we used the range function, which directs the loop to start from 1 and run till less than 11, i.e. 10. Inside the loop, multiply “i” by “n” and store in the result in the variable value.

Also, Check Multiplication Tables in Python Using Recursion

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

Also, Check the Multiplication Table in Python Using For Loop

If you want to learn Python programming, you can refer to this Python Online Course with Certification. It’s easy to understand and meant for beginners who have no background in programming.

About The Author