Articles

Program to print multiplication table of a given number in Python

Program to print multiplication table of a given number in Python


In this python programming guide, we are going to learn

  • program to print multiplication table of a given number in python

Python program to print multiplication table of a number

The program to print multiplication table of a given number in python is as follows:

# Owner : TutorialsInhand Author : Devjeet Roy

num = int(input("Enter a number: "))

print("The multiplication table is as follows:")

for i in range(1,11):
    print("{} x {} = {}".format(num,i, num*i))

The output of python program to print multiplication table of a number is as follows:

 

PS C:\Users\DEVJEET\Desktop\tutorialsInHand> python code.py
Enter a number: 4
The multiplication table is as follows:
4 x 1 = 4
4 x 2 = 8
4 x 3 = 12
4 x 4 = 16
4 x 5 = 20
4 x 6 = 24
4 x 7 = 28
4 x 8 = 32
4 x 9 = 36
4 x 10 = 40

We can enter other number as input in above python program to print multiplication table of a given number and check the output.

 

Few important tips about this program

1. First we ask the user to input a number and then we convert the data type to integer type.

2. Then by repeating a loop from 1 to 10, a multiplication table is being printed.

3. The format() method replaces the placeholder "{}" with a given value.

 

Program to print multiplication table of a given number in python snapshot:

python program to print multiplication table of a number

 


Basic Python Programs

Would you like to see your article here on tutorialsinhand. Join Write4Us program by tutorialsinhand.com

About the Author
Devjeet Roy
Full Stack Web Developer & Data Science Enthusiast
Page Views :    Published Date : Mar 08,2021  
Please Share this page

Related Articles

Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!