You are viewing a single comment's thread. Return to all comments →
def print_rangoli(size): n = size letter = 96 + n max_len = 4*n-3 strings = [] for i in range(n): s = [] for j in range(letter, letter-i-1, -1): s.append(chr(j)) for k in range(letter-i+1, letter+1): s.append(chr(k)) strings.append("-".join(s)) for string in strings: print(f"{string:-^{max_len}}") for string in range(len(strings)-2, -1,-1): print(f"{strings[string]:-^{max_len}}")
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 →