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.
- Prepare
- Python
- Strings
- Alphabet Rangoli
- Discussions
Alphabet Rangoli
Alphabet Rangoli
Sort by
recency
|
1388 Discussions
|
Please Login in order to post a comment
if you guies want a math, no list and pure logical then can reffer to this:
Am I dumb?
def print_rangoli(size): x = 1
if name == 'main': n = int(input()) print_rangoli(n)
def print_rangoli(size): #upper triangle for i in range(1,size+1): print("-"(2(size-i)),end="") if(i==1): print(chr(97+size-i),end="") else: for j in range(1,i+1): print(chr(97+size-j)+"-",end="") for j in range(i-1,0,-1): if(j==1): print(chr(97+size-j),end="") break print(chr(97+size-j)+"-",end="") print("-"(2(size-i))) #lower triangle for i in range(size-1,0,-1): print("-"(2(size-i)),end="") if(i==1): print(chr(97+size-i),end="") else: for j in range(1,i+1): print(chr(97+size-j)+"-",end="") for j in range(i-1,0,-1): if(j==1): print(chr(97+size-j),end="") break print(chr(97+size-j)+"-",end="") print("-"(2(size-i)))