### Task:

You have to write a function `pattern` which returns the following Pattern(See Examples) upto (2n-1) rows, where n is parameter.

* Note:`Returning` the pattern is not the same as `Printing` the pattern.

#### Parameters:
    
    pattern(        n        );
                    ^                     
                    |                     
             Term upto which   
           Basic Pattern(this)     
                should be         
                 created            
                                  
                                
#### Rules/Note:
* If `n < 1` then it should return "" i.e. empty string.
* `The length of each line is same`, and is equal to the length of longest line in the pattern i.e (2n-1).
* Range of Parameters (for the sake of CW Compiler) :
  + `n ∈ (-∞,100]`

### Examples:

* pattern(5):

        1       1
         2     2 
          3   3  
           4 4   
            5    
           4 4   
          3   3  
         2     2 
        1       1
       
        
* pattern(10):

        1                 1
         2               2 
          3             3  
           4           4   
            5         5    
             6       6     
              7     7      
               8   8       
                9 9        
                 0         
                9 9        
               8   8       
              7     7      
             6       6     
            5         5    
           4           4   
          3             3  
         2               2 
        1                 1
    
* pattern(15):

        1                           1
         2                         2 
          3                       3  
           4                     4   
            5                   5    
             6                 6     
              7               7      
               8             8       
                9           9        
                 0         0         
                  1       1          
                   2     2           
                    3   3            
                     4 4             
                      5              
                     4 4             
                    3   3            
                   2     2           
                  1       1          
                 0         0         
                9           9        
               8             8       
              7               7      
             6                 6     
            5                   5    
           4                     4   
          3                       3  
         2                         2 
        1                           1
    
[List of all my katas]("http://www.codewars.com/users/curious_db97/authored")

Difficulty: EASY
Starter code: def pattern(n):
	

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


def pattern(n):
	quarters = (''.join((str(j % 10) if j == i else ' ' for j in range(1, n))) for i in range(1, n))
	half = '\n'.join((f'{quarter} {quarter[::-1]}' for quarter in quarters)) + '\n' + ' ' * (n - 1)
	return f'{half}{n % 10}{half[::-1]}' if n > 1 else '1' if n > 0 else ''


def pattern(n):
	(c, p) = (0, 0)
	(t, final) = ('', '')
	for i in range(2 * n - 1):
		if i >= n:
			c -= 1
		else:
			c += 1
		if c > 9:
			temp = str(c)
			p = int(temp[-1])
		else:
			p = c
		for j in range(2 * n - 1):
			if j == i or j == 2 * n - 2 - i:
				if i < n:
					t += str(p)
				else:
					t += str(p)
			else:
				t += ' '
		final += t + '\n'
		t = ''
	return final[0:-1]


def pattern(n):
	if n <= 0:
		return ''
	li = []
	for i in range(1, n):
		temp = [str(i % 10) if j == i - 1 else ' ' for j in range(n - 1)]
		li.append(''.join(temp) + ' ' + ''.join(temp[::-1]))
	return '\n'.join(['\n'.join(li), str(n % 10).center(n * 2 - 1), '\n'.join(li[::-1])])


from itertools import chain

def pattern(n):

	def f():
		length = 2 * n - 1
		lines = [' '] * length
		for i in chain(range(1, n + 1), range(n - 1, 0, -1)):
			x = str(i % 10)
			lines[i - 1] = lines[-i] = x
			yield lines
			lines[i - 1] = lines[-i] = ' '
	return '\n'.join(map(''.join, f()))


def pattern(n):
	up = ['{0}{1}{0}'.format(x % 10, ' ' * (2 * (n - x) - 1)).center(2 * n - 1) for x in range(1, n)]
	return '\n'.join(up + [str(n % 10).center(2 * n - 1)] + up[::-1]) if n > 0 else ''


def pattern(n):
	if n < 1:
		return ''
	wing = '\n'.join(((str(i % 10) + ' ' * (2 * (n - i) - 1) + str(i % 10)).center(2 * n - 1) for i in range(1, n)))
	return '\n'.join([wing, str(n % 10).center(2 * n - 1), wing[::-1]])


def pattern(n):
	s = '\n'.join((' ' * i + str(i + 1)[-1] + ' ' * (2 * n - 1 - 2 * (i + 1)) + str(i + 1)[-1] + ' ' * i for i in range(n - 1)))
	s1 = '\n' + ' ' * (n - 1) + str(n)[-1] + ' ' * (n - 1) + '\n'
	return '' if n < 1 else s + s1 + s[::-1]


get_r = lambda y: str((y + 1) % 10)
row = lambda n, i: ' ' * i + get_r(i) + ' ' * max(0, 2 * n - 3 - i * 2) + (get_r(i) if i != n - 1 else '') + ' ' * i

def pattern(n):
	if n < 1:
		return ''
	top = [row(n, x) for x in range(n - 1)]
	return '\n'.join(top + [row(n, n - 1)] + list(reversed(top)))


def pattern(n):
	lines = []
	for i in range(1, n + 1):
		line = ' ' * (i - 1) + str(i % 10) + ' ' * (n - i)
		lines.append(line + line[-2::-1])
	return '\n'.join(lines + lines[-2::-1])