Geek is very fond of patterns. Once, his teacher gave him a pattern to solve. He gave Geek an integer n and asked him to build a pattern.
Help Geek to build the pattern.
 
Example 1:
Input: 5
Output:
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
 
Your Task:
You don't need to input anything. Complete the function printTriangle() which takes  an integer n  as the input parameter and print the pattern.
Constraints:
	1<= N <= 20

Difficulty: EASY

Starter code:
#User function Template for python3



class Solution:

    def printTriangle(self, N):

        # Code here

Solutions:
class Solution:

	def printTriangle(self, N):
		for i in range(N):
			for j in range(i + 1):
				print(j + 1, end=' ')
			for j in range(2 * N - 2 * (i + 1)):
				print(' ', end=' ')
			for j in range(i + 1, 0, -1):
				print(j, end=' ')
			print('')


class Solution:

	def printTriangle(self, N):
		for i in range(1, N + 1):
			for j in range(1, i + 1):
				print(j, end=' ')
			for k in range(i, 2 * N - i):
				print(' ', end=' ')
			t = i
			for l in range(2 * N - t, 2 * N):
				print(i, end=' ')
				i = i - 1
			print('')


class Solution:

	def printTriangle(self, n):
		for i in range(1, n + 1):
			for j in range(1, i + 1):
				print(j, end=' ')
			for k in range(2 * (n - i)):
				print(' ', end=' ')
			for j in range(i, 0, -1):
				print(j, end=' ')
			print()


class Solution:

	def printTriangle(self, N):
		spacing = 2
		for i in range(1, N + 1):
			for x1 in range(1, i + 1):
				print(x1, end=' ')
			for _ in range(2 * N - 2 * i, 0, -1):
				print(' ', end=' ')
			for x2 in range(i, 0, -1):
				print(x2, end=' ')
			print()


class Solution:

	def printTriangle(self, N):
		i = 1
		while i <= N:
			j = 1
			while j <= i:
				print(j, end=' ')
				j += 1
			spaces = 1
			while spaces <= 2 * (N - i):
				print(' ', end=' ')
				spaces += 1
			k = 1
			while k <= i:
				print(i - k + 1, end=' ')
				k += 1
			print()
			i += 1


class Solution:

	def printTriangle(self, N):
		for i in range(N):
			num1 = 0
			for j in range(i + 1):
				print(num1 + 1, end=' ')
				num1 += 1
			for k in range(2 * (N - i) - 2):
				print(' ', end=' ')
			num2 = i
			for l in range(i + 1):
				print(num2 + 1, end=' ')
				num2 -= 1
			print()


class Solution:

	def printTriangle(self, N):
		space = '  '
		for i in range(1, N + 1):
			for j in range(1, i + 1):
				print(j, end=' ')
				if j == i:
					print(space * 2 * (N - i), end='')
					for q in range(i, 0, -1):
						print(q, end=' ')
			print(end='\n')


class Solution:

	def printTriangle(self, N):
		for i in range(1, N + 1):
			for x in range(1, i + 1):
				print(x, end=' ')
			for y in range(4 * N - 4 * i):
				print(' ', end='')
			for z in range(i, 0, -1):
				print(z, end=' ')
			print()
		return


class Solution:

	def printTriangle(self, N):
		a = 4 * N + 1
		l = range(1, N + 1)
		for i in range(N):
			print(*l[:i + 1], sep=' ', end='')
			print(' ' * (a - 4), end='')
			print(*l[i::-1])
			a -= 4


class Solution:

	def printTriangle(self, N):
		for i in range(1, N + 1):
			for j in range(1, i + 1):
				print(j, end=' ')
			spaces = ' ' * (4 * (N - i))
			print(spaces, end='')
			for j in range(i, 0, -1):
				print(j, end=' ')
			print()


class Solution:

	def printTriangle(self, N):
		for i in range(1, N + 1):
			for j in range(1, N + 1):
				if j <= i:
					print(j, end=' ')
				else:
					print(end='  ')
			for k in reversed(range(1, N + 1)):
				if k <= i:
					print(k, end=' ')
				else:
					print(end='  ')
			print()


class Solution:

	def printTriangle(self, N):
		spaces = 2 * N - 2
		for i in range(1, N + 1):
			for j in range(1, i + 1):
				print(j, end=' ')
			for _ in range(spaces):
				print(' ', end=' ')
			for j in range(i, 0, -1):
				print(j, end=' ')
			spaces = spaces - 2
			print('\n', end='')


class Solution:

	def printTriangle(self, N):
		for row in range(1, N + 1):
			for col in range(1, row + 1):
				print(col, end=' ')
			for col in range(2 * N - 2 * row):
				print('  ', end='')
			for col in range(row, 0, -1):
				print(col, end=' ')
			print()


class Solution:

	def printTriangle(self, N):
		for row in range(1, N + 1):
			start = 1
			for digit in range(1, row + 1):
				print(start, end=' ')
				start += 1
			for empty in range(1, 2 * N - 2 * row + 1):
				print(' ', end=' ')
			for digit in range(1, row + 1):
				start -= 1
				print(start, end=' ')
			print('')


class Solution:

	def printTriangle(self, N):
		for i in range(1, N + 1):
			for j in range(1, 2 * N + 1):
				if j <= i:
					print(j, end=' ')
				elif j >= 2 * N - i + 1:
					print(2 * N - j + 1, end=' ')
				else:
					print(' ', end=' ')
			print()


class Solution:

	def printTriangle(self, N):
		for i in range(1, N + 1):
			print(*list(range(1, i + 1)), end=' ' * (4 * (N - i) + 1))
			print(*list(range(i, 0, -1)))


class Solution:

	def printTriangle(self, N):
		c = 1
		s = str(c)
		k = s
		for j in range(N):
			print(s + ' ' * (4 * (N - j - 1) + 1) + k)
			c += 1
			s += ' ' + str(c)
			k = str(c) + ' ' + k


class Solution(object):

	def printTriangle(self, N):
		for row in range(1, N + 1):
			for col in range(1, 2 * N + 1):
				val = col
				if col > N:
					val = 2 * N - col + 1
				if val > row:
					val = ' '
				if col == 2 * N:
					print(val)
				else:
					print(val, end=' ')


class Solution:

	def printTriangle(self, N):
		for i in range(N):
			first = last = ''
			for j in range(i + 1):
				first = first + str(j + 1)
				if j != i:
					first += ' '
				last = last + ' ' + str(i - j + 1)
			space = '  ' * (2 * (N - i - 1))
			print(first + space + last)


class Solution:

	def printTriangle(self, N):
		for row in range(1, N + 1):
			num_spaces = N * 2 - row * 2
			for num in range(1, row + 1):
				print('{0} '.format(num), end='')
			print(num_spaces * 2 * ' ', end='')
			for num in range(row, 0, -1):
				print('{0} '.format(num), end='')
			print()


class Solution:

	def printTriangle(self, n):
		for i in range(1, n + 1):
			a = [j for j in range(1, i + 1)]
			b = ' ' * (n - i)
			a.extend(b)
			print(*a, *a[::-1])