A curated daily collection of pattern printing challenges to master loops, logic, and problem-solving in Python.
Browse Patterns • Repository Structure • How to Run • Logic Cheat Sheet
Pattern printing is one of the best ways to build a rock-solid foundation in:
- Nested loop mechanics (outer loops for rows, inner loops for columns/spaces)
- Mathematical and index manipulation
- Spatial reasoning and algorithmic thinking
This repository tracks my journey of uploading at least one new pattern problem every day, complete with multiple approaches (nested loops vs. string multiplication) and visual output examples.
Patterns/
│
├── Star-Pattern/ # Star & symbol patterns
│ ├── LeftSideTriangle.py # Day 01: Left-sided upright triangle
│ ├── LeftReverseTriangle.py # Day 02: Inverted left-sided triangle
│ ├── LeftTriangelOutline.py # Day 03: Hollow left-sided triangle outline
│ └── LeftTriangelInvertedOutline.py # Day 04: Hollow inverted left-sided triangle outline
│
├── Number-Pattern/ # (Upcoming) Number triangles, Pascal, Floyd's
├── Alphabet-Pattern/ # (Upcoming) Character pyramids, letter matrices
└── Advanced-Pattern/ # (Upcoming) Hollow shapes, butterfly, spirals
| Day | Pattern Name | Category | Code Link | Visual Preview |
|---|---|---|---|---|
| 01 | Left-Sided Triangle | Star | LeftSideTriangle.py |
****** |
| 02 | Left Reverse Triangle | Star | LeftReverseTriangle.py |
****** |
| 03 | Left Triangle Outline | Star | LeftTriangelOutline.py |
** ****** |
| 04 | Inverted Left Triangle Outline | Star | LeftTriangelInvertedOutline.py |
****** ** |
git clone https://github.com/GOKUL05102003/Pattern-Programming.git
cd Pattern-ProgrammingRun any pattern script directly using Python:
# General Syntax:
python <folder-name>/<file-name>.py
# Examples:
python Star-Pattern/LeftSideTriangle.py
python Star-Pattern/LeftReverseTriangle.py
python Star-Pattern/LeftTriangelOutline.py
python Star-Pattern/LeftTriangelInvertedOutline.pyWhen prompted, enter the number of rows (e.g., 5):
Enter the no. of Rows: 5
When solving any pattern problem, follow this 4-step framework:
-
Rows (Outer Loop): Count the total rows (
$n$ ). Loop from1ton(orndown to1for reverse patterns). -
Spaces (Inner Loop 1): Determine if spaces depend on the row index (e.g.,
$n - i$ ). -
Symbols / Values (Inner Loop 2): Identify how characters change per line (e.g., boundary conditions
j == 1 or j == i or i == nfor outlines). - New Line: Print a line break after each row finishes printing.
- If you have any feedback, ideas, or suggestions, feel free to open an Issue!
- If you find this project helpful for your learning journey, please leave a Star ⭐ to support the repository.