Alphabet Rangoli

  • + 0 comments

    def print_rangoli(size): length=((size * 2) - 1) base = [abs(size - x - 1) for x in range(length)] for i in range(length): new = [x + base[i] for x in base] prepend='' for e in new: if e > size - 1: print(prepend+'-', end='') else: print(prepend+chr(ord('a')+e), end='') prepend='-' print('')