Alphabet Rangoli

  • + 0 comments

    def print_rangoli(size): s,l='',[] if size==1: print('a') else: for i in range(96+size,96,-1): for j in range(96+size,i-1,-1): s=s+chr(j)+'-'

            if len(s)!=2:
                l.append((s+s[len(s)-4::-1]).center((size-1)*4+1,'-'))
            else:
                l.append(s.center((size-1)*4+1,'-'))
            s=''
        for h in l:
            print(h)
        for k in l[len(l)-2::-1]:
            print(k)