Geek is very fond of patterns. Once, his teacher gave him a  pattern to solve. He gave Ram an integer n and asked him to build a pattern.
Help Ram build a pattern.
 
Example 1:
Input: 5
Output:
    *
   ***  
  *****
 *******
*********
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

Source: geeksforgeeks | 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(N - i - 1):
				print(' ', end='')
			for k in range(2 * i + 1):
				print('*', end='')
			print()


class Solution:

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


class Solution:

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


class Solution:

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


class Solution:

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


class Solution:

	def printTriangle(self, N):
		l = []
		count = 0
		for x in range(1, N * 5):
			if x % 2 != 0 and count < N:
				count += 1
				l.append(x)
		for x in l:
			print(' ' * ((l[-1] - x) // 2) + '*' * x)


class Solution:

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


class Solution:

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


class Solution:

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


class Solution:

	def printTriangle(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 += 2
			print()


class Solution:

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


class Solution:

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


class Solution:

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


class Solution:

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


class Solution:

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


class Solution:

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


class Solution:

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


class Solution:

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


class Solution:

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


class Solution:

	def printTriangle(self, N):
		arr = list(range(1, N + 1))
		new_arr = []
		p = 0
		q = 0
		for item in arr:
			p = 2 * item - 1
			new_arr.append('*' * p)
		for item in new_arr:
			q = int(len(new_arr) - new_arr.index(item) - 1)
			print(' ' * q + item)


class Solution:

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