Fir tree

Created by Julien Palard

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.hackinscience.org/?n=10

https://sapin.hackinscience.org/?n=5

etc...

Here is what it should look like:

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

There's no corrections yet, hit the `Submit` button to send your code to the correction bot.

Keyboard shortcuts:

  • Ctrl-Enter: Send your code to the correction bot.
  • Escape: Get back to the instructions tab.

See solutions