Hi, Try this:
import sys for i in range (1, 5+1): for j in range (i): sys.stdout.write(str(i)) print "print" adds a newline character print "hi", notice the comma, it won't add newline, however it adds a space With sys.stdout.write you can print the way you want, it won't add any extra stuff (newline or space). Best, Laszlo On Mon, Apr 30, 2012 at 13:52, Daniel <dan...@kingdread.de> wrote: > You could also try http://docs.python.org/library/stdtypes.html#str.join > like this: > for i in range(5): > print "".join(str(i) for j in range(i)) > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list