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: 4
Output:
****
*  *
*  *
****
 
Your Task:
You don't need to input anything. Complete the function printSquare() 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):
				if i == 0 or j == 0 or i == N - 1 or (j == N - 1):
					print('*', end='')
				else:
					print(' ', end='')
			print('')


class Solution:

	def printTriangle(self, N):
		i = 0
		while i < N:
			if i == 0 or i == N - 1:
				j = 0
				while j < N:
					print('*', end='')
					j += 1
			else:
				j = 0
				while j < N:
					if j == 0 or j == N - 1:
						print('*', end='')
						j += 1
					else:
						print(' ', end='')
						j += 1
			print()
			i += 1


import os

class Solution:

	def printTriangle(self, n):
		for i in range(n):
			for j in range(n):
				if i == 0 or i == n - 1 or j == 0 or (j == n - 1):
					print('*', end='')
				else:
					print(' ', end='')
			print()


class Solution:

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


class Solution:

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


class Solution:

	def printTriangle(self, N):
		for x in range(1, N + 1):
			if x == 1:
				for y in range(N):
					print('*', end='')
			elif x == N:
				for m in range(N):
					print('*', end='')
			else:
				print('*', end='')
				for z in range(N - 2):
					print(' ', end='')
				print('*', end='')
			print()
		return


class Solution(object):

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


class Solution:

	def printTriangle(self, N):
		for row in range(N):
			if row == 0 or row == N - 1:
				for star in range(N):
					print('*', end='')
			else:
				num_spaces = N - 2
				print('*', end='')
				for space in range(num_spaces):
					print(' ', end='')
				print('*', end='')
			print()


class Solution:

	def printTriangle(self, N):
		for i in range(0, N):
			if i != 0 and i != N - 1:
				for k in range(0, N):
					if k == 0 or k == N - 1:
						print('*', end='')
					else:
						print(' ', end='')
			else:
				for z in range(0, N):
					print('*', end='')
			print()


class Solution:

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


import math

class Solution:

	def printTriangle(self, N):
		spaces = N - 2
		for i in range(1, N + 1):
			if N / i == 1 or N / i == N:
				print('*' * N)
			else:
				print('*' + spaces * ' ' + '*')


class Solution:

	def printTriangle(self, n):
		for i in range(n):
			for j in range(n):
				if (i > 0 and i < n - 1) and (j > 0 and j < n - 1):
					print(' ', end='')
					continue
				print('*', end='')
			print()


class Solution:

	def printTriangle(self, n):
		for i in range(n):
			for j in range(n):
				if i == 0 or i == n - 1:
					var = ''
					if j == n - 1:
						var = '\n'
					print('*', end=var)
					continue
				var = ''
				if j == n - 1:
					var = '\n'
				if j == 0 or j == n - 1:
					print('*', end=var)
				else:
					print(' ', end=var)