Question: I'm not able to remove the spacing in a `for`-loop as numbers are not coming in the same for making the pattern.

My code:

```
for i in range(1,5):
    for j in range(1,i):
       print(j)

```

Produces the following result:

```
1
1
2
1
2
3

```

But my desired output is:

```
1
12
123
1234

```

Answer: 
Try this:

```
print(j, end='')

```

`end` by default is `\n` (see [`print()`](http://docs.python.org/3/library/functions.html#print)). Also, be sure to print a newline at the end of each outer loop iteration:

```
for i in range(1,6):  # notice that I changed this to 6
    for j in range(1,i):
        print(j, end='')  # added end=''
    print()  # printing newline here

```

```

1
12
123
1234

```

---

**EDIT** I just noticed you were using Python 2.7. Since that's the case, you can use `print j,` instead of `print(j, end='')` and `print` instead of `print()`. Note that `print j,` will leave spaces between the `j`s. If you don't want this, you can `import sys` and use `sys.stdout.write(j)` instead (see [`sys`](http://docs.python.org/2/library/sys.html)).

Furthermore, if you want to use the Python 3 print function as shown above, you can always

```
from __future__ import print_function

```
```
for r in range(1,5):
    for c in range (1,r+1):
        print c,
    print

```

here, the print without argument causes printing in the next line