Write a program to print a table of any number in Python | Code

  • by

Using for loop and range() function you can print a table of any number in Python. And if you want to take input from the user then use the input method.

A program to print a table of any number in Python

Simple example code using a print statement, print the multiplication tables of the given number.

n = int(input("Enter the number: "))

for i in range(1, 11):
    print(n, "x", i, "=", n * i)

Output:

Write a program to print a table of any number in Python

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

Note: IDE: PyCharm 2021.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

Your email address will not be published. Required fields are marked *

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