You are viewing a single comment's thread. Return to all comments →
def print_rangoli(number): total_rows = [] for i in range(1,(number+1)): row_length = i descending_part = [chr(96 + number - j) for j in range(row_length)] rows = descending_part + descending_part[-2::-1] total_rows.append("-".join(rows)) max_width = len(total_rows[-1]) for k in total_rows: print(k.center(max_width,"-")) for k in reversed(total_rows[:-1]): print(k.center(max_width,"-"))
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 →