Python program for multiplication table | Example code

Use for loop, range() function, and input method to get the multiplication table in Python.

Python program for multiplication table exmaple

Simple example code will print the multiplication table of the user given number (from 1 to 10) by using them for a loop.

We are using “for loop” to iterate the multiplication 10 times. The range() functions are (1, 11) equal to greater than or equal to 1 and less than 11.

num = int(input("Enter the number table: "))

for count in range(1, 11):
    print(num, 'x', count, '=', num * count)

Output: Print the multiplication table of variable num (which is 11 in our case).

Python program for multiplication table

Do comment if you have any doubts and suggestions on this Python table program code.

Note: IDE: PyCharm 2021.1.3 (Community Edition)

Windows 10

Python 3.7

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

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.