Skip to content

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 or suggestions on this Python table number 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