title: Python 2.7 - Print a pyramid made of letters with given amount of layers
body: <p>My question is almost the same as <a href="https://stackoverflow.com/questions/58845247/python-pyramid-of-letters">Python - Pyramid of letters</a>. I want the same output as in that question, a pyramid made of letters. The desired output:</p>
  
  <pre><code>              a 
               aba
              abcba
             abcdcba
            abcdedcba
           abcdefedbca
          abcdefgfedcba
         abcdefghgfedcba
        abcdefghihgfedcba
       abcdefghijihgfedcba
      abcdefghijkjihgfedcba
     abcdefghijklkjihgfedcba
    abcdefghijklmlkjihgfedcba
   abcdefghijklmnmlkjihgfedcba
  abcdefghijklmnonmlkjihgfedcba
  </code></pre>
  
  <p>The code the OP provides in that question is: </p>
  
  <pre><code>def pyramid():
      for middle_letter in range(ord("a"), ord("o")+1):
          for letter in range(ord("a"), ord(middle_letter)+1):
              print chr(letter),
          for letter in reversed(range(ord("a"), ord(middle_letter))):
              print chr(letter),
          middle_letter += 1
  
  pyramid()
  </code></pre>
  
  <p>This code doesn't provide the wanted output. The function in the code also doesn't use any parameters. The answer that's been given to that question imports the modern print() functionality, but I'm not allowed to do that. I'm not allowed to use any import functions, and I have to stick to python 2.7.
  The requirements are that I have to use function(s) with parameter(s), the pyramid's desired outcome must have 15 levels and the screen width is 80 characters. </p>
  
  <p>I tried making a function with a parameter that prints a letter in the middle of the screen with the range of 15, and I can now print one single letter in the middle of a line, but I can't figure out how to make the step from a to aba to abcba etc.</p>
  
  <pre><code>def level_center(letter):
      for i in range(15):
          middle = letter.center(80)
          print middle
  level_center('b')
  </code></pre>
  
  <p>With my code, the output I get is:</p>
  
  <pre><code>                                       b                                        
                                         b                                        
                                         b                                        
                                         b                                        
                                         b                                        
                                         b                                        
                                         b                                        
                                         b                                        
                                         b                                        
                                         b                                        
                                         b                                        
                                         b                                        
                                         b                                        
                                         b                                        
                                         b                 
  </code></pre>
  
  <p>I am aware that with my current function, calling level_center() will only print one single letter on each level. But I have no clue where to go from here.</p>
  
  <p>How can the other OPs code or my code be improved in such a way that I get the desired outcome while sticking to the requirements(using functions with parameters, screen width 80 characters, 15 layers, has to work without an import function (from <strong>future</strong> import print_function line))?</p>