We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
defprint_rangoli(s):lst="a b c d e f g h i j k l m n o p q r s t u v w x y z".split()list=lst[:s]list.reverse()foriinrange(1,len(list)+1):revlist=list[:i-1]revlist.reverse()revlist=list[:i]+revlistprint(("-".join(revlist)).center(s*4-3,"-"))foriinrange(len(list)-1,0,-1):revlist=list[:i-1]revlist.reverse()revlist=list[:i]+revlist#print(revlist)print(("-".join(revlist)).center(s*4-3,"-"))if__name__=='__main__':n=int(input())print_rangoli(n)
Cookie support is required to access HackerRank
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 →