try something like this: x = 0 while x < 10: z = 0 print '-' + str(x) + '-' x = x + 1 while z < x: print '.' + str(z) + '.', z = z + 1