generate-z

Ricky gives a number 'n' to John. Now Ricky wants John to generate Z with symbol "*" such that it spans n rows.

Example:

Input : n=3

Output :

***
  *
***

Input : n=4

Output :

****
   *
  *
****

Constraint :

3 ≤ n ≤20

SAMPLE INPUT
5

SAMPLE OUTPUT
*****
   *
  *
 *
*****

Explanation

The 'Z' is printed across 5 lines as shown above.

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
n=int(input())
print('*'*n)
for i in range(n-2):
	print(' '*(n-i-2) + '*')
print('*'*n)


import sys
n=eval(input())
for i in range(n):
	for j in range(n):
		if(i==0):
			sys.stdout.write('*')
		elif(i==n-1):
			sys.stdout.write('*')
		elif(i+j==n-1):
			sys.stdout.write('*')
		elif(i+j<n-1):
			sys.stdout.write(' ')
	print("")
	


'''
Created on Jan 28, 2015

@author: ansh
'''
from string import rjust
def drawZ(n):
	s=''
	for i in range(n):
		s=s+'*'
	print((s), end=' ')
def printZ(n):
	for i in range(n):
		if i in [0,n-1]:
			drawZ(n)
			print('')
		else:
			print('*'.rjust(n-i))
n=eval(input())         
printZ(n)
			


n = eval(input())
z = ""
for _ in range(n):
	z +="*"
print(z)


for row in range(2,n):
	z = " "
	for col in range(n-1,1,-1):
		if col == row:
			z+="*"
			break
		else:
			z+=" "
	print(z)
z = ""
for _ in range(n):
	z += "*"
print(z)
	


n=int(input())
#print n
for i in range(n):
	if i==0 or i==n-1:
		print('*'*n)
	else:
		print(' '*(n-i-2),'*')
		#print '*'


n = int(input())

print('*' * n)

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

print('*' * n)