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.
**def print_rangoli(size):
# your code goes here
alphabet=[chr(i) for i in range(97,123)]
alphabet=alphabet[:size]
indices=list(range(size))
indices=indices[:-1]+indices[::-1]
for i in indices:
start_index=i+1
original=alphabet[-start_index:]
reverse=original[::-1]
row=reverse+original[1:]
row="-".join(row)
width=size*4-3
row=row.center(width,"-")
print(row)
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 →
**def print_rangoli(size): # your code goes here alphabet=[chr(i) for i in range(97,123)] alphabet=alphabet[:size]
if name == 'main': n = int(input()) print_rangoli(n)**