Write a program to print multiplication table pattern in given image

Question:

For more info please open the picture
enter image description here

i tried to print the multiplication table but i was expecting to print the table according to given question image.enter image description here

Asked By: Anand

||

Answers:

One line version

print('n'.join(' '.join(str(i*n) for n in range(1,i+1)) for i in range(1,9)))

1
2 4
3 6 9
4 8 12 16
5 10 15 20 25
6 12 18 24 30 36
7 14 21 28 35 42 49
8 16 24 32 40 48 56 64

Expanded Version

for i in range(1,9):
    print(' '.join(str(i*n) for n in range(1,i+1)))

1
2 4
3 6 9
4 8 12 16
5 10 15 20 25
6 12 18 24 30 36
7 14 21 28 35 42 49
8 16 24 32 40 48 56 64

Beginner version

for i in range(1,9):
    for j in range(1,i+1):
        print(i*j," ",end="")
    print()
1
2 4
3 6 9
4 8 12 16
5 10 15 20 25
6 12 18 24 30 36
7 14 21 28 35 42 49
8 16 24 32 40 48 56 64
Answered By: geekay