Javaexercise.com

Write a Program to generate a Pyramid

Program to generate pyramid like patterns require certain amount of logical ability to use loops and spaces combinedly. To generate a below pattern, we have a created a program here.


*
* *
* * *
* * * *

Program Example

This program is tested and executed using Atom IDE with Python 3.8 version.

for i in range(0,5):
    for j in range(0,i):
        print("*",end=' ')
    print()
 Output:

*
* *
* * *
* * * *