To print multiplication table of any number in python, you have to first ask from user to enter the number and start calculating its table to print the multiplication table of the given number as shown in the program given below.
Following python program ask from user to enter a number and prints multiplication table of that number:
# Python Program - Print Multiplication Table of a Number print("Enter 'x' for exit."); num = input("Enter a number: "); if num == 'x': exit(); else: number = int(num); for i in range(1, 11): print(number, "*", i, "=", number*i);
Here is the sample run of the above python program to illustrates how to print multiplication table of any number:
Above is the sample initial output asking from user to enter that number whose multiplication table he/she want to print, say 2 and then press enter key to see the table as shown in the below screenshot of sample output:
Here is the same program written and run on python shell:
You may also like to learn or practice the same program in other popular programming languages: