We use Python 3.6

go back Level: Intermediate (img: IM / score: 3) level Bite 119. Xmas tree generator

15 out of 15 users completed this Bite ...
Will you be Pythonista #16 to crack this Bite?
Average Bite difficulty 1-10 rating: 2.0
» You can do it! 😌

In this Bite you complete generate_xmas_tree that takes a rows arg (= height of the tree). For each row you print row_number*2-1 stars and center them, so for default height=10 the tree would look like this:

         *
        ***
       *****
      *******
     *********
    ***********
   *************
  ***************
 *****************
*******************

No printing to the console this time, you return this output from the function (use newlines / \n between the lines). Good luck and keep calm and code in Python!

Github login button