0

My code:

for i in range(2, 13):
  print(i, "Multiplication table")
  for j in range(1, 13):
    print(i, "x", j, " = ", i * j)
  print()

How can I print the output in columns?

Timus
  • 10,974
  • 5
  • 14
  • 28
Imoh
  • 1
  • 2
  • There's an existing question, [Printing Lists as Tabular Data](/q/9535954/4518341). Is that what you're asking? Do the answers answer your question? For tips, see [ask]. You can [edit] your post to add details if needed. – wjandrea Apr 02 '22 at 20:34

1 Answers1

1

I think the key is to use lists.

multiplications = []

for i in range(2, 13):
    multiplications.append([f"multiplication table of {i}" if j == 0 else j*i for j in range(0, 13)])

for table in multiplications:
    print(table)
ClGide
  • 43
  • 5