Challenge: PyramidChallenge: Pyramid

Task

Write a recursive function draw_pyramid that takes an integer height and prints a pyramid of asterisks with a height of height to the console.

Expected Output:

Conditions:

  1. To solve this task, you need to use a recursive approach.
  2. The input number height should be positive.
  3. The pyramid is formed using the '*' symbol and spaces. Each row of the pyramid should have 2 * height - 1 characters (asterisks or spaces).
  4. The top row should have one asterisk, the next row should have three, and so on, increasing the number of asterisks by two in each new row.
  5. All asterisks should be centered in the rows using spaces.
  6. The pyramid should be printed using the print function.

Everything was clear?

Section 4. Chapter 2
toggle bottom row