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.
w = (n*2-1)*2 - 1
al = "abcdefghijklmnopqrstuvwxyz"
for i in range(n-1,-1,-1):
a=f"{al[i]}"
for x in range(i+1,n):
a= f"{al[x]}-" +a+ f"-{al[x]}"
print(a.center(w,"-"))
for i in range(1,n):
a=f"{al[i]}"
for x in range(i+1,n):
a= f"{al[x]}-" +a+ f"-{al[x]}"
print(a.center(w,"-"))
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(n):
if name == 'main': n = int(input()) print_rangoli(n)