Use for loop, range() function, and input method to get the multiplication table in Python.
Python program for multiplication table example
A 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).
Do comment if you have any doubts or suggestions on this Python table program 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.