You are viewing a single comment's thread. Return to all comments →
Nice came up with something very similar but using slicing:
def print_rangoli(size): width = 4 * size - 3 alpha = string.ascii_lowercase for i in list(range(size))[::-1] + list(range(1, size)): print('-'.join(alpha[size-1:i:-1] + alpha[i:size]).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 →
Nice came up with something very similar but using slicing: