Q:

python - printing result of for loop the not-usual way?

The following code snippet:
i = 3

for i in range(1, i+1):

  for j in range (1, i+1):
    print j

outputs:
 1
 1
 2
 1
 2
 3

but the output I want is:
 1
 1 2
 1 2 3

A:

Use print j, to keep the output in the same line, then print at the end of each row to get to the row below:
i = 3

for i in range(1, i+1):
    for j in range (1, i+1):
        print j,
    print

I would suggest, as a note, the better, python3 compatible version:
rows = 5
for row_max in range(1, rows+1):
    print(' '.join(str(j) for j in range(1, row_max+1)))

