You are viewing a single comment's thread. Return to all comments →
def build_line(size, idx): line = "" spacer_len = ((size - (idx+1)) * 2) line += "-" * spacer_len letters = [] for j in range(idx + 1): letters += ALPHABET[(size-1)-j] for k in range(idx - 1, -1, -1): letters += ALPHABET[(size-1)-k] line += "-".join(letters) line += "-" * spacer_len return line def print_rangoli(size): for i in range(size): print(build_line(size, i)) for i in range(size - 2, -1, -1): print(build_line(size, i))
Seems like cookies are disabled on this browser, please enable them to open this website
Alphabet Rangoli
You are viewing a single comment's thread. Return to all comments →