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

Difficulty: MEDIUM

Starter code:
#User function Template for python3



class Solution:

    def printDiamond(self, N):

        # Code here

Solutions:
class Solution:

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


class Solution:

	def printDiamond(self, N):
		k = N
		for i in range(1, N + 1):
			print((N - i) * ' ' + '* ' * i)
		while N >= 1:
			print((k - N) * ' ' + '* ' * N)
			N = N - 1


class Solution:

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


class Solution:

	def printDiamond(self, N):
		for i in range(1, 2 * N + 1, 1):
			j = 0
			temp = 0
			if i > N:
				temp = 2 * N - i + 1
			else:
				temp = i
			space = 1
			for space in range(1, N - temp + 1, 1):
				print(' ', end='')
				space += 1
			j = 0
			for j in range(temp):
				print('*', '', end='')
				j += 1
			print()
			i += 1


class Solution:

	def printDiamond(self, N):
		for x in range(1, N + 1):
			print(' ' * (N - x) + '* ' * x)
		for x in range(N, 0, -1):
			print(' ' * (N - x) + '* ' * x)


class Solution:

	def printDiamond(self, N):
		iter1 = 1
		for i in range(N, 0, -1):
			for j in range(i - 1, 0, -1):
				print(' ', end='')
			for k in range(iter1):
				print('*', end=' ')
			print()
			iter1 += 1
		iter2 = N
		for i in range(N):
			for j in range(i):
				print(' ', end='')
			for k in range(iter2):
				print('*', end=' ')
			print()
			iter2 -= 1


class Solution:

	def printDiamond(self, N):
		for i in range(1, N + 1):
			left = (N - i) * ' '
			stars = '* ' * i
			print(left + stars)
		for j in range(N, 0, -1):
			left = (N - j) * ' '
			stars = '* ' * j
			print(left + stars)


class Solution:

	def printDiamond(self, N):
		i = 0
		while i < N:
			spaces = 0
			while spaces < N - i - 1:
				print(' ', end='')
				spaces += 1
			stars = 0
			while stars <= i:
				print('*', end=' ')
				stars += 1
			print()
			i += 1
		j = 0
		while j < N:
			spaces = 0
			while spaces < j:
				print(' ', end='')
				spaces += 1
			stars = 0
			while stars < N - j:
				print('*', end=' ')
				stars += 1
			print()
			j += 1


class Solution:

	def printDiamond(self, N):
		prev = 1
		for i in range(N):
			for j in range(N - i - 1):
				print(' ', end='')
			if i == 0:
				print('*', end='')
			else:
				k = prev
				while k != 0:
					print('* ', end='')
					k -= 1
			prev += 1
			print()
		for i in range(N, 0, -1):
			for k in range(N - i):
				print(' ', end='')
			for j in range(0, i):
				print('* ', end='')
			print()


class Solution:

	def printDiamond(self, n):
		for i in range(1, 2 * n + 1):
			if i <= n:
				spaces = n - i
				stars = i
			else:
				spaces = i - n - 1
				stars = 2 * n - i + 1
			for j in range(spaces):
				print(' ', end='')
			for j in range(stars):
				print('*', end=' ')
			print()


class Solution:

	def printDiamond(self, n):
		for i in range(n):
			for space in range(n - i - 1):
				print(' ', end='')
			for s in range(i + 1):
				print('* ', end='')
			print()
		for i in range(n):
			for s in range(i):
				print(' ', end='')
			for x in range(n - i):
				print('*', end=' ')
			print()


class Solution:

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


class Solution:

	def printDiamond(self, n):
		for i in range(1, 2 * n + 1):
			x = abs(i - n)
			y = i
			if i > n:
				x = abs(i - n - 1)
				y = abs(2 * n - i + 1)
			for j in range(x):
				print(' ', end='')
			for j in range(y):
				print('*', end=' ')
			print('')


class Solution:

	def printDiamond(self, N):
		for row in range(N):
			for sp in range(N - row - 1):
				print(' ', end='')
			for star in range(row + 1):
				print('* ', end='')
			print()
		for row_1 in range(N):
			for sp_1 in range(row_1):
				print(' ', end='')
			for star_1 in range(N - row_1):
				print('* ', end='')
			print()


class Solution:

	def printDiamond(self, N):
		arr = list(range(1, N + 1))
		new_Arr1 = []
		new_Arr2 = []

		def print1():
			for item in arr:
				new_Arr1.append('* ' * item)
			for item in new_Arr1:
				p = N - 1 - new_Arr1.index(item)
				print(' ' * p + item)

		def print2():
			for item in arr:
				new_Arr2.append('* ' * item)
			new_Arr2.sort(reverse=True)
			for item in new_Arr2:
				q = new_Arr2.index(item)
				print(' ' * q + item)
		print1()
		print2()


class Solution:

	def printDiamond(self, N):
		(space, star) = (N - 1, 1)
		for i in range(N):
			print(' ' * space, end='')
			print('* ' * star)
			space -= 1
			star += 1
		space += 1
		star -= 1
		for i in range(N):
			print(' ' * space, end='')
			print('* ' * star)
			space += 1
			star -= 1


class Solution:

	def printDiamond(self, N):
		for i in range(1, 2 * N + 1):
			if i <= N:
				print(' ' * (N - i) + '* ' * i)
			else:
				print(' ' * (i - N - 1) + '* ' * (2 * N - i + 1))


class Solution:

	def printDiamond(self, N):
		l = list(range(1, N + 1)) + list(range(N, 0, -1))
		for i in l:
			print(' ' * (N - i) + '* ' * l[i - 1])


class Solution:

	def printDiamond(self, N):
		for x in range(1, N + 1):
			for m in range(N - x):
				print(' ', end='')
			for y in range(x):
				print('* ', end='')
			print()
		for x in range(N, 0, -1):
			for m in range(N - x):
				print(' ', end='')
			for y in range(x):
				print('*', end=' ')
			print()
		return


class Solution:

	def printDiamond(self, N):
		for i in range(1, N):
			space = ' ' * (N - i)
			ast = '* ' * i
			print(space + ast)
		a = '* ' * N
		print(a)
		print(a)
		for j in range(1, N):
			space = ' ' * (j - 1)
			ast = '* ' * (N - j)
			print(space, ast)


class Solution:

	def printDiamond(self, N):
		for j in range(1, N + 1):
			for k in range(N - j, 0, -1):
				print(' ', end='')
			for l in range(1, j + 1):
				print('*', end=' ')
			print()
		for m in range(N, 0, -1):
			for n in range(N - m, 0, -1):
				print(' ', end='')
			for o in range(1, m + 1):
				print('*', end=' ')
			print()


class Solution:

	def printDiamond(self, N):
		for i in range(1, N + 1):
			for j in range(1, N + 1 - i):
				print(' ', end='')
			for k in range(1, i + 1):
				if k % 2 == 1:
					print('*', end='')
				else:
					print(' ', end='')
			for l in range(1, i):
				if i % 2 == 0:
					if l % 2 == 0:
						print(' ', end='')
					else:
						print('*', end='')
				elif l % 2 == 0:
					print('*', end='')
				else:
					print(' ', end='')
			print()
		for i in range(N, 0, -1):
			for j in range(1, N + 1 - i):
				print(' ', end='')
			for k in range(1, i + 1):
				if k % 2 == 1:
					print('*', end='')
				else:
					print(' ', end='')
			for l in range(1, i):
				if i % 2 == 0:
					if l % 2 == 0:
						print(' ', end='')
					else:
						print('*', end='')
				elif l % 2 == 0:
					print('*', end='')
				else:
					print(' ', end='')
			print()


class Solution:

	def printDiamond(self, n):
		for i in range(n):
			print(' ' * (n - i - 1) + '* ' * (i + 1))
		for i in range(n + 1, 2 * n + 1):
			print(' ' * (i - n - 1) + '* ' * (2 * n - i + 1))


class Solution:

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


class Solution:

	def printDiamond(self, N):
		for i in range(1, N + 1):
			x = N - i
			for j in range(x):
				print(' ', end='')
			for k in range(i):
				print('*', end=' ')
			print()
		for a in range(N, 0, -1):
			x = N - a
			for b in range(x):
				print(' ', end='')
			for c in range(a):
				print('*', end=' ')
			print()


class Solution:

	def printDiamond(self, n):
		s = '* '
		a = ' '
		for i in range(1, n + 1):
			d = n - i
			print(a * d + s * i)
		for i in range(n, 0, -1):
			d = n - i
			print(a * d + s * i)


class Solution:

	def printDiamond(self, N):
		for i in range(0, 2 * N):
			for j in range(0, 2 * N):
				if i < N:
					if j in range(N - 1 - i, N + i):
						if N % 2 != 0:
							if i % 2 == 0 and j % 2 == 0:
								print('*', end=' ')
							elif i % 2 != 0 and j % 2 != 0:
								print('*', end=' ')
						elif i % 2 == 0 and j % 2 != 0:
							print('*', end=' ')
						elif i % 2 != 0 and j % 2 == 0:
							print('*', end=' ')
					elif j < N - 1 - i:
						print(' ', end='')
				elif j in range(-(N - i), 3 * N - i):
					if N % 2 == 0:
						if i % 2 == 0 and j % 2 == 0:
							print('*', end=' ')
						elif i % 2 != 0 and j % 2 != 0:
							print('*', end=' ')
					elif i % 2 == 0 and j % 2 != 0:
						print('*', end=' ')
					elif i % 2 != 0 and j % 2 == 0:
						print('*', end=' ')
				elif j < -(N - i):
					print(' ', end='')
			print('\n', end='')


class Solution:

	def printDiamond(self, N):
		k = '*'
		l = []
		for j in range(N):
			s = ' ' * (N - j - 1) + k
			l.append(s)
			k += ' *'
			print(s)
		for j in range(N - 1, -1, -1):
			print(l[j])