Star Pyramid

Lab Python Intermediate 20 points

Read n and print a centred pyramid of stars with n rows. Row i (from 1) has n−i spaces then 2i−1 stars.

Input

One integer.

Output

n rows.

Example

Input

4

Output

   *
  ***
 *****
*******
Sample input available Sample output available
Editor
Python

Hints

Work out the number of spaces and stars for each row, then use string repetition.

Solution explanation

Pattern problems are about finding a formula for each row.

Show solution
n = int(input())
for i in range(1, n + 1):
    print(" " * (n - i) + "*" * (2 * i - 1))
Output
Answer
HOME LEARN COMMUNITY DASHBOARD