Jun-18-2018, 02:45 AM
So im trying to get this as the output:
Output: 1 2 3
1| 1 2 3
2| 2 4 6
3| 3 6 9
Here's the code i'm using:print(''' 1 2 3''',end="") for i in range(1,4): if i==1: print("") print('{:>1}|'.format(i),end="") for j in range(1,4): print('{:>2}'.format(i*j))My issue is that after each loop in i runs, the output of i*jprints in the next line, so you get the output as:
Output: 1 2 3
1| 1
2
3
2| 2
4
6
3| 3
6
9
I'm new to python. please help