🔹 1. Star Patterns


🧩 Pattern 1: Right-Angled Triangle

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

rows = 5
for i in range(1, rows + 1):
    print("* " * i)

🧩 Pattern 2: Inverted Triangle

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

rows = 5
for i in range(rows, 0, -1):
    print("* " * i)

🧩 Pattern 3: Pyramid

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

rows = 5
for i in range(1, rows + 1):
    print(" " * (rows - i) + "* " * i)

🧩 Pattern 4: Diamond Shape

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

rows = 5
for i in range(1, rows + 1):
    print(" " * (rows - i) + "* " * i)
for i in range(rows - 1, 0, -1):
    print(" " * (rows - i) + "* " * i)

🧩 Pattern 5: Hollow Pyramid

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

rows = 5
for i in range(1, rows + 1):
    for j in range(1, rows + 1):
        if j == rows - i + 1 or j == rows + i - 1 or i == rows:
            print("*", end="")
        else:
            print(" ", end="")
    print()

🔹 2. Number Patterns


🧩 Pattern 1: Increasing Triangle

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

rows = 5
for i in range(1, rows + 1):
    for j in range(1, i + 1):
        print(j, end=" ")
    print()

🧩 Pattern 2: Repeated Number Triangle

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

rows = 5
for i in range(1, rows + 1):
    print((str(i) + " ") * i)

🧩 Pattern 3: Inverted Number Triangle

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

rows = 5
for i in range(rows, 0, -1):
    for j in range(1, i + 1):
        print(j, end=" ")
    print()

🧩 Pattern 4: Pascal-like Number Pyramid

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

rows = 5
for i in range(1, rows + 1):
    print(" " * (rows - i), end="")
    for j in range(1, i + 1):
        print(j, end=" ")
    print()

🧩 Pattern 5: Continuous Increasing Numbers

1
2 3
4 5 6
7 8 9 10

rows = 4
num = 1
for i in range(1, rows + 1):
    for j in range(i):
        print(num, end=" ")
        num += 1
    print()

🔹 3. Alphabet (Character) Patterns


🧩 Pattern 1: Increasing Alphabet Triangle

A
A B
A B C
A B C D
A B C D E

rows = 5
for i in range(rows):
    for j in range(i + 1):
        print(chr(65 + j), end=" ")
    print()

🧩 Pattern 2: Repeated Alphabet Triangle

A
B B
C C C
D D D D
E E E E E

rows = 5
for i in range(rows):
    print((chr(65 + i) + " ") * (i + 1))

🧩 Pattern 3: Inverted Alphabet Triangle

A B C D E
A B C D
A B C
A B
A

rows = 5
for i in range(rows, 0, -1):
    for j in range(i):
        print(chr(65 + j), end=" ")
    print()

🧩 Pattern 4: Alphabet Pyramid

    A
   A B
  A B C
 A B C D
A B C D E

rows = 5
for i in range(rows):
    print(" " * (rows - i), end="")
    for j in range(i + 1):
        print(chr(65 + j), end=" ")
    print()

🧩 Pattern 5: Continuous Alphabet Pattern

A
B C
D E F
G H I J

rows = 4
ch = 65
for i in range(rows):
    for j in range(i + 1):
        print(chr(ch), end=" ")
        ch += 1
    print()

Summary Table

TypePattern ExampleKey Concept
⭐ StarPyramid, DiamondLoops + spaces
🔢 NumberIncremental or repetitiveNested for loops
🔤 AlphabetASCII (chr() / ord())Nested loops + chr()

In short:

  • Use nested loops (for inside for) to print patterns.
  • Use spaces (" " * n) for alignment.
  • Use ASCII conversion (chr(65 + i)) for alphabet patterns.
  • Combine logic + formatting for creative outputs.

Scroll to Top