๐ Python Pattern Challenge — Day 34 | Double Triangle Star Pattern
Welcome to Day 34 of the Python Pattern Challenge! ๐
Today, we're exploring a simple yet interesting Double Triangle Star Pattern using Python. This pattern combines two triangular shapes side by side, creating a symmetrical design with stars and spaces.
Pattern printing is a great way to strengthen your logical thinking, understand loops, and learn how spacing affects the final output.
๐ฏ Today's Challenge
Write a Python program to print exactly the following pattern:
๐ป Python Solution
n = 5 for i in range(1, n + 1): left = "* " * i spaces = " " * (n - i) right = "* " * i print(left + spaces + right)
๐ง How It Works
Creating the rows
The for loop runs from 1 to 5, increasing the number of stars in each row.
Printing the left triangle
left = "* " * iThis repeats the star symbol according to the current row number.
Controlling the spaces
spaces = " " * (n - i)This reduces the gap between the two triangles as the rows progress.
Printing the right triangle
right = "* " * iThis creates the second triangle, mirroring the first one.
Displaying the pattern
print(left + spaces + right)This combines both triangles and the middle spacing into one row.
๐ Challenge Yourself
Increase the number of rows to 7.
Replace * with
#or another symbol.Create an inverted version of the pattern.
Try printing the pattern using nested loops.
Take the number of rows as input from the user.
Practice the code, experiment with the spacing, and see how small changes can create completely different patterns!
34 Days. 34 Patterns. Stronger Python Logic. ๐๐ฅ
Learn • Practice • Grow with CLCODING ๐ป
.png)

.png)
.png)

.png)



