🐍 Python Pattern Challenge — Day 2
Pattern printing is a great way to strengthen your Python logic, loops, and problem-solving skills. What looks like a simple arrangement of * can actually teach you how to control rows, spaces, and repetition.
Today's Challenge
Write a Python program to print:
* * * * * * * * * * * * * * *
Best and cleanest code will be rewarded!
Solution 1 — Using a for Loop
for i in range(5): print(" " * i + "* " * (5 - i))
How it works:
- " " * i → adds increasing spaces.
- "* " * (5 - i) → decreases the number of stars on every row.
Solution 2 — Using Nested Loops
This approach is useful for beginners because it clearly shows how nested loops control spaces and stars separately.
Solution 3 — Using String Formatting
Here, we build each row dynamically and then add the required indentation.
Challenge Yourself
Can you create the same pattern:
- Without using nested loops?
- Using a while loop?
- In the shortest possible Python code?
Drop your solution below! 👇
Learn • Practice • Grow with CLCODING

