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.
mylist = ["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"];
list1 = [];
a = mylist[size - 1]
list1.append(a);
y = size + (size - 1);
w = (y * 2) - 1;
e = 1;
f = 2;
for i in range(1,size + 1):
g = "-".join(list1);
print(g.center(w,"-"));
b = mylist[size - (i + 1)];
c = (i + 1) - 1;
d = mylist[size - c];
list1.insert(e,b);
list1.insert(f,d);
e = e + 1;
f = f + 1;
h = size;
del list1[h];
del list1[h];
x = size - 1;
for j in range(size):
del list1[x];
if(list1 != []):
del list1[x];
g = "-".join(list1);
print(g.center(w,"-"));
x = x - 1;
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):
if name == 'main': n = int(input()) print_rangoli(n)