You are viewing a single comment's thread. Return to all comments →
def print_rangoli(size): width = (size*2)-1 right_width = (size*2)-3 word_list = [] if size == 1: print('a') elif size != 1: for i in range(1, size+1): word_list.append(chr(i+96)) word_list2 = word_list[ 1 : len(word_list)] for i in range(size-1, -1, -1): print('-'.join(word_list[i:])[::-1].rjust(width, '-') + '-' + '-'.join(word_list[i+1:]).ljust(right_width, '-')) for i in range(size-1): print('-'.join(word_list2[i:])[::-1].rjust(width, '-') + '-' + '-'.join(word_list2[i+1:]).ljust(right_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 →