← Previous

Sapin

Created by Julien Palard

Instructions

You'll write a Python 3 program drawing a fir tree.

The size of the drawed fir tree will depend on the single parameter given to your program. As always, print a human error message if no parameter are given to your program.

Given 0, your program should display nothing.

Advice

You can test is for several values of the parameter here:

https://sapin.herokuapp.com/?n=10

https://sapin.herokuapp.com/?n=5

etc...

Here is what it should look like:

$ for i in $(seq 5); do  python3 solution.py $i; done
   *
  ***
 *****
*******
   |
      *
     ***
    *****
   *******
    *****
   *******
  *********
 ***********
*************
     |||
     |||
          *
         ***
        *****
       *******
        *****
       *******
      *********
     ***********
    *************
     ***********
    *************
   ***************
  *****************
 *******************
*********************
         |||
         |||
         |||
              *
             ***
            *****
           *******
            *****
           *******
          *********
         ***********
        *************
         ***********
        *************
       ***************
      *****************
     *******************
    *********************
      *****************
     *******************
    *********************
   ***********************
  *************************
 ***************************
*****************************
            |||||
            |||||
            |||||
            |||||
                   *
                  ***
                 *****
                *******
                 *****
                *******
               *********
              ***********
             *************
              ***********
             *************
            ***************
           *****************
          *******************
         *********************
           *****************
          *******************
         *********************
        ***********************
       *************************
      ***************************
     *****************************
       *************************
      ***************************
     *****************************
    *******************************
   *********************************
  ***********************************
 *************************************
***************************************
                 |||||
                 |||||
                 |||||
                 |||||
                 |||||

Results