Write python program to print out a neatly formatted multiplication table, up to 12 x 12. It should be a triangle shape with minimum size
时间: 2024-05-09 07:21:44 浏览: 116
Sure, I can help you with that.
Here's a Python program that prints out a neatly formatted multiplication table up to 12 x 12:
```
for i in range(1, 13):
for j in range(1, i+1):
product = i * j
print('{:2d} x {:2d} = {:3d}'.format(j, i, product), end=' ')
print('\n')
```
This program uses two nested `for` loops to generate the product of each number up to 12 with every other number up to that same limit. The `format()` method is used to format the output with leading zeros for single-digit numbers and adequate spacing. The output of this program will be a neatly formatted multiplication table in a triangle shape with minimum size as requested.
I hope this helps! Let me know if you have any other questions.
阅读全文