Star Pyramid

Easy 20 XPPatternsLoops

Commonly asked at Zoho, Infosys

Read n and print a centred pyramid of * with n rows. Row i has (n - i) leading spaces followed by (2i - 1) stars. Don't print trailing spaces.

Input
One integer n.
Output
n lines.

Sample 1

Input

3

Output

  *
 ***
*****

Read input with input() (no prompt message) and print only the answer. Run tries the Input box; Submit checks all test cases.

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.
The solution unlocks after 3 submissions.