In the Python Program, we will learn how to display the multiplication table. Here, we have used the for-loop along with the range() function to iterate 10 times.
Here is the source code to display the multiplication table.
# Python Program to Display the multiplication Table
# To take input from the user
num = int(input("Display multiplication table of: "))
# Iterate 10 times from i = 1 to 10
for i in range(1, 11):
print(num, 'x', i, '=', num*i)
Display multiplication table of: 15
15 x 1 = 15
15 x 2 = 30
15 x 3 = 45
15 x 4 = 60
15 x 5 = 75
15 x 6 = 90
15 x 7 = 105
15 x 8 = 120
15 x 9 = 135
15 x 10 = 150
Comments