In examinations or Interviews, or in Real Life, we need the Mathematics of Multiplication. And hence this session focus on the program for multiplication table in Python.
If you want to see all the practice examples and Explanations of Python, then please use this reference to this URL.
Also Read: The Complete Python Practice Series
Program to Print Multiplication Table in Python Using for Loop
n = int(input("Enter any Number :")); for i in range(1,11): value = n * i print(n," * ",i," = ",value)
Enter any Number :5 5 * 1 = 5 5 * 2 = 10 5 * 3 = 15 5 * 4 = 20 5 * 5 = 25 5 * 6 = 30 5 * 7 = 35 5 * 8 = 40 5 * 9 = 45 5 * 10 = 50
The above program is a simple program to print multiplication tables in Python using For Loop. Here, the user enters the input of any number of his choice, but since we have used “int”, it cannot accept the decimal values.
Then we write the “for loop”, 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 for loop, multiply “i” by “n” and store in the result in the variable value. And the next print statement is very important to display the result correctly. Just like the multiplication table we used to write in the book during our School Days.
If you want the video explanation of the Program, don’t worry. We got you covered. Please go through the below video. All your queries will be resolved.
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.