Develop a Python program that will display the multiplication table represented by the two non negative integers in a text file. The first integer will be the rows and the second integer will be the columns of the multiplication table.
TEXT FILE
3 5
4 2
OUTPUT
3x5
1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4x2
1 2 3 4
2 4 6 8
3 6 9 12
4 8 12 16
path = "text.txt"
lines = [i.split() for i in open(path, 'r').readlines()]
for x in lines:
 height, width = int(x[0]), int(x[1])
 print("(", height, "," , width, ")")
 for i in range(1,height+1):
  for j in range(1,width+1):
   print(i*j, end='\t')
  print()
Don't forget to include "text.txt" file with your inputs
Comments
Leave a comment