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.
for i in range(1,size+1):
cha = ""
for j in range(i):
cha = cha+chr(ord("a")+size-1-j)
if len(cha)!=1:
cha = cha+cha[(len(cha)-2)::-1]
print(("-".join(cha)).center(l,"-"))
for i in range(size-1,0,-1):
cha = ""
for j in range(i):
cha = cha+chr(ord("a")+size-1-j)
if len(cha)!=1:
cha = cha+cha[(len(cha)-2)::-1]
print(("-".join(cha)).center(l,"-"))
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 →
def print_rangoli(size): l = size*4-3