Using loops to draw patterns(Pyramid) @ Dcoder

Words
50
Reading
1 min
Listen
Play
3y

Problem: Draw the pattern specified using loops.
Input:
Output: The pattern as shown in sample output.
First line contain 4 space and 1 star, next line contains 3 space and 3 stars and so on..
Constraints: Try not to hardcode the output.
Sample Input:
Sample Output:
*





for i in range(1, 6):
  print(' '*(5-i) + '*'*(i*2-1))
Using loops to draw patterns(Pyramid) @ Dcoder | Ecency