Skip to content

Instantly share code, notes, and snippets.

@libert-xyz
Created July 15, 2016 17:16
Show Gist options
  • Select an option

  • Save libert-xyz/5914c467913612009c26f57e4a5f895f to your computer and use it in GitHub Desktop.

Select an option

Save libert-xyz/5914c467913612009c26f57e4a5f895f to your computer and use it in GitHub Desktop.
#7/15/16
#https://www.hackerrank.com/challenges/text-alignment
ti = int(raw_input()) #an odd number
c = '@'
w = ' '
#Top
for i in range(ti):
print (c*i).rjust(ti-1,'*')+c+(c*i).ljust(ti-1,'+')
#pilars
for i in range(i):
print (c*ti).center(ti*2)+(w*((ti**2)/2))+(c*ti).ljust(ti)
#center
for i in range(i):
print (c*ti).rjust(ti+ti/2,'*')+(c*((ti**2)/2))+(c*(ti+ti/2))+c
#pilars2
for i in range(i):
print (c*ti).center(ti*2)+(w*((ti**2)/2))+(c*ti).ljust(ti)
#botton
l = ti-1
for i in range(ti):
print (w*((ti**2)/2))+(w*(ti+ti/2))+ (c*l).rjust(ti-1,'*')+c+(c*l).ljust(ti-1,'+')
l = l - 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment