How to Display the multiplication Table using Python?


You can create the multiplication table for any number using a simple loop. 

example

def print_mul_table(num):
   for i in range(1, 11):
      print("{:d} X {:d} = {:d}".format(num, i, num * i))
print_mul_table(5)

Output

This will give the output

5 X 1 = 5
5 X 2 = 10
5 X 3 = 15
5 X 4 = 20
5 X 5 = 25
5 X 6 = 30
5 X 7 = 35
5 X 8 = 40
5 X 9 = 45
5 X 10 = 50

Updated on: 05-Mar-2020

292 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements