###Task:

You have to write a function **pattern** which creates the following Pattern(See Examples) upto n(parameter) number of rows.

####Rules/Note:
* If the Argument is 0 or a Negative Integer then it should return "" i.e. empty string.
* All the lines in the pattern have same length i.e equal to the number of characters in the last line.
* Range of n is (-∞,100]

###Examples:

pattern(5):

        1    
       121   
      12321  
     1234321 
    123454321


pattern(10):

             1         
            121        
           12321       
          1234321      
         123454321     
        12345654321    
       1234567654321   
      123456787654321  
     12345678987654321 
    1234567890987654321

pattern(15):

                  1              
                 121             
                12321            
               1234321           
              123454321          
             12345654321         
            1234567654321        
           123456787654321       
          12345678987654321      
         1234567890987654321     
        123456789010987654321    
       12345678901210987654321   
      1234567890123210987654321  
     123456789012343210987654321 
    12345678901234543210987654321

pattern(20):

                       1                   
                      121                  
                     12321                 
                    1234321                
                   123454321               
                  12345654321              
                 1234567654321             
                123456787654321            
               12345678987654321           
              1234567890987654321          
             123456789010987654321         
            12345678901210987654321        
           1234567890123210987654321       
          123456789012343210987654321      
         12345678901234543210987654321     
        1234567890123456543210987654321    
       123456789012345676543210987654321   
      12345678901234567876543210987654321  
     1234567890123456789876543210987654321 
    123456789012345678909876543210987654321

###Amazing Fact: 


```Hint: Use \n in string to jump to next line```

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def pattern(n):
	

Solutions:
def pattern(n):
	output = []
	for i in range(1, n + 1):
		wing = ' ' * (n - i) + ''.join((str(d % 10) for d in range(1, i)))
		output.append(wing + str(i % 10) + wing[::-1])
	return '\n'.join(output)


def pattern(n):
	result = []
	for i in range(1, n + 1):
		string = ''
		for j in range(n, i, -1):
			string += ' '
		for j in range(1, i):
			string += str(j)[-1]
		for j in range(i, 0, -1):
			string += str(j)[-1]
		for j in range(n, i, -1):
			string += ' '
		result.append(string)
	return '\n'.join(result)


def pattern(n):
	l = []
	for (a, b) in zip(range(1, n + 2), range(n + 1)):
		res = ''.join((str(x % 10) for x in range(1, a)))
		spaces = n - len(res)
		if res:
			l.append(spaces * ' ' + res + res[-2::-1] + ' ' * spaces)
	return '\n'.join(l)


from itertools import cycle, islice

def f(n):
	it = cycle('1234567890')
	xs = ''.join(islice(it, 0, n - 1))
	return xs + next(it) + xs[::-1]

def pattern(n):
	m = n * 2 - 1
	return '\n'.join(('{:^{}}'.format(f(i), m) for i in range(1, n + 1)))


def pattern(n):
	t = []
	for i in range(1, n + 1):
		t.append((n - i) * ' ' + ls(i) + +(n - i) * ' ')
	return '\n'.join(t)

def ls(k):
	ls = [str(j % 10) for j in range(1, k)]
	return ''.join(ls) + str(k % 10) + ''.join(ls[::-1])


def pattern(n):
	mkP = lambda y: str(y % 10)
	return '\n'.join([' ' * (n - x - 1) + ''.join(map(mkP, range(1, x + 1))) + ''.join(map(mkP, range(x + 1, 0, -1))) + ' ' * (n - x - 1) for x in range(n)])