You are viewing a single comment's thread. Return to all comments →
from string import ascii_lowercase as asl
def print_rangoli(size): width = (size * 2 - 1) * 2 - 1 l0 = list(range(size)) + list(range(size))[::-1][1:]
for i in l0: l1 = list(asl[:size][::-1][:i+1] + asl[:size][::-1][:i][::-1]) l2 = "-".join(l1) print(l2.center(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 →
from string import ascii_lowercase as asl
def print_rangoli(size): width = (size * 2 - 1) * 2 - 1 l0 = list(range(size)) + list(range(size))[::-1][1:]