Raj was to move up through a pattern of stairs of a given number **(n)**. Help him to get to the    top using the function **stairs**.

##Keep in mind :
  * If **n<1** then return ' ' .
  * There are a lot of spaces before the stair starts except for **pattern(1)**


##Examples :
  pattern(1)

          1 1

  pattern(6)

                          1 1
                      1 2 2 1  
                  1 2 3 3 2 1
              1 2 3 4 4 3 2 1
          1 2 3 4 5 5 4 3 2 1
      1 2 3 4 5 6 6 5 4 3 2 1

pattern(12)

                                                  1 1
                                              1 2 2 1
                                          1 2 3 3 2 1
                                      1 2 3 4 4 3 2 1
                                  1 2 3 4 5 5 4 3 2 1
                              1 2 3 4 5 6 6 5 4 3 2 1
                          1 2 3 4 5 6 7 7 6 5 4 3 2 1
                      1 2 3 4 5 6 7 8 8 7 6 5 4 3 2 1
                  1 2 3 4 5 6 7 8 9 9 8 7 6 5 4 3 2 1
              1 2 3 4 5 6 7 8 9 0 0 9 8 7 6 5 4 3 2 1
          1 2 3 4 5 6 7 8 9 0 1 1 0 9 8 7 6 5 4 3 2 1
      1 2 3 4 5 6 7 8 9 0 1 2 2 1 0 9 8 7 6 5 4 3 2 1

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def stairs(n):
	

Solutions:
def stairs(n):
	return '\n'.join((step(i).rjust(4 * n - 1) for i in range(1, n + 1)))

def step(n):
	h = ' '.join((str(i % 10) for i in range(1, n + 1)))
	return f'{h} {h[::-1]}'


from itertools import chain

def stairs(n):
	if n < 1:
		return ' '
	w = 4 * n - 1
	xs = [str(i % 10) for i in chain(range(1, n + 1), range(n, 0, -1))]
	return '\n'.join((' '.join(xs[:i] + xs[-i:]).rjust(w) for i in range(1, n + 1)))


from itertools import chain
gen = lambda x: chain(range(1, x + 1), range(x, 0, -1))
concat = lambda x: ' '.join((str(y % 10) for y in gen(x)))
padding = lambda size: lambda x: f'{concat(x): >{size}}'

def stairs(n):
	return '\n'.join(map(padding(4 * n - 1), range(1, n + 1)))


def stairs(n):
	return '\n'.join((' '.join([str(j % 10) for j in range(1, i + 1)] + [str(j % 10) for j in range(i, 0, -1)]).rjust(4 * n - 1) for i in range(1, n + 1)))


def stairs(n):
	a = [' '.join([str(e)[-1] for e in range(1, i + 2)] + [str(i - e + 1)[-1] for e in range(i + 1)]) for i in range(n)]
	return '\n'.join((e.rjust(4 * n - 1) for e in a))


def stairs(n):
	(l, s) = ([], [])
	for i in range(1, n + 1):
		l.append(str(i % 10))
		s.append(' '.join(l + l[::-1]))
	return '\n'.join((r.rjust(len(s[-1])) for r in s))


def create_line(number):
	nums_for_line = [num if num < 10 else num % 10 for num in range(1, number + 1)]
	result = nums_for_line + nums_for_line[::-1]
	return ' '.join(map(str, result))

def stairs(number):
	lines = [create_line(num) for num in range(1, number + 1)]
	max_length = number * 4 - 1
	return '\n'.join((line.rjust(max_length) for line in lines))


def stairs(n):
	(c, r) = ('1 2 3 4 5 6 7 8 9 0'.split(), [])
	for i in range(n):
		temp = [c[j % 10] for j in range(i + 1)]
		r.append((' '.join(temp) + ' ' + ' '.join(temp[::-1])).rjust(n * 4 - 1))
	return '\n'.join(r)


def stairs(n):
	r = lambda n: [str(i % 10) for i in range(1, n + 1)]
	up_down = lambda n: r(n) + r(n)[::-1]
	steps = [' '.join(up_down(i)) for i in range(1, n + 1)]
	l = len(steps[-1])
	return '\n'.join([r.rjust(l) for r in steps])