Skip to content

Python program to print multiplication table from 1 to 10 | Code

  • by

Use the range() function with for loop to print the multiplication table from 1 to 10 in Python.

Example print multiplication table from 1 to 10 in Python

Simple example code Multiplication table of 1 to 10 using nested loop.

for i in range(1, 11):
    print("\n\nMULTIPLICATION TABLE FOR %d\n" % (i))
    
    for j in range(1, 11):
        print("%-5d X %5d = %5d" % (i, j, i * j))

Output:

Python program to print multiplication table from 1 to 10

A function that prints out tables from 1 to 10 using iteration

A function that will print out multiplication tables from 1-10. This will iterate with values for x in the range [1-10]

def tables():
    for x in range(1, 11):

        print("")

        for y in range(1, 11):
            print(x * y, end=" ")


tables()

Output:

C:\Users\Rohit\PycharmProjects\pythonProject\venv\Scripts\python.exe C:\Users\Rohit\PycharmProjects\pythonProject\modules\main.py

1 2 3 4 5 6 7 8 9 10 
2 4 6 8 10 12 14 16 18 20 
3 6 9 12 15 18 21 24 27 30 
4 8 12 16 20 24 28 32 36 40 
5 10 15 20 25 30 35 40 45 50 
6 12 18 24 30 36 42 48 54 60 
7 14 21 28 35 42 49 56 63 70 
8 16 24 32 40 48 56 64 72 80 
9 18 27 36 45 54 63 72 81 90 
10 20 30 40 50 60 70 80 90 100 
Process finished with exit code 0

Do comment if you have any doubts or suggestions on this Python multiplication table code.

Note: IDE: PyCharm 2021.3.3 (Community Edition)

Windows 10

Python 3.10.1

All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.

Leave a Reply

Discover more from Tutorial

Subscribe now to keep reading and get access to the full archive.

Continue reading