Javatpoint Logo
Javatpoint Logo

Programs for Printing Pyramid Technique in Python

Python offers basic for loops for printing patterns. The first outer loop manages the number of rows, while the inner nested loop manages the number of columns. By modifying the print statements, new number patterns, word patterns, and star patterns could be printed.

This article illustrates a few of the patterns.

1. Simple Pyramid Pattern

Output

* 
* * 
* * * 
* * * * 
* * * * *

2. Python 3's List feature would make this process simpler.

Output

*
**
***
****
*****

3. Recursion Method

Output

* 
* * 
* * * 
* * * * 
* * * * *

4. While Loop Using

Output

* 
* * 
* * * 
* * * * 
* * * * *

5. Rotation Method with 180 degrees

Output

        * 
      * * 
    * * * 
  * * * * 
* * * * *

6. Printing Triangle

Output

   * 
   * * 
  * * * 
 * * * * 
* * * * *

7. Number Pattern

Output

1 
1 2 
1 2 3 
1 2 3 4 
1 2 3 4 5

Next TopicSeed in Python





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA