Loading...
Loading...
Loading...
A certificate template shows a centred pyramid of stars. Row 1 has one star in the middle, and every next row has two more stars than the one above. Spaces on the left keep the pyramid centred; there are no spaces after the stars.
Given n, print n rows.
Example
Input
3
Output
* *** *****
Two spaces before the first star, one before the next row.
Try the problem first. Open one hint at a time.
Look at the first row: it has n - 1 spaces and then 1 star. Find how both numbers change from row to row.
Row i has n - i spaces and 2 * i - 1 stars. Use string repetition to build each line.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor