Tuesday, 27 October 2026

๐Ÿ Python Pattern Challenge — Day 36

 




๐Ÿ Python Pattern Challenge — Day 36 | Number Mirror Pyramid

Welcome to Day 36 of the Python Pattern Challenge! ๐Ÿš€

Today, we're creating a beautiful Number Mirror Pyramid using Python. This pattern combines increasing and decreasing number sequences to create a symmetrical design that becomes smaller with each row.

It's a great exercise for beginners who want to improve their understanding of loops, number sequences, spacing, and logical thinking.

๐ŸŽฏ Today's Challenge

Write a Python program to print exactly this pattern:










๐Ÿ’ป Python Solution

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






๐Ÿง  How It Works

Creating the rows

for i in range(n, 0, -1):

This loop starts at 5 and decreases to 1, creating five rows of decreasing width.

Adding spaces

print(" " * (n - i), end="")

This adds leading spaces to shift each row toward the right and form a triangular shape.

Printing increasing numbers

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

This prints numbers from 1 up to the current row number.

Printing decreasing numbers

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

This prints the numbers in reverse order without repeating the largest number.

For example, when i = 5, the row becomes:

1 2 3 4 5 4 3 2 1

๐Ÿš€ Challenge Yourself

  • Increase the starting number to 7.

  • Create the same pattern using a while loop.

  • Replace numbers with alphabets.

  • Print the pattern in reverse order.

  • Create a full diamond by adding an expanding lower section.

  • Take the maximum number from the user as input.

Share your solution in the comments! ๐Ÿ‘‡

36 Days. 36 Patterns. Stronger Python Logic. ๐Ÿ๐Ÿ”ฅ

Learn • Practice • Grow with CLCODING


0 Comments:

Post a Comment

Popular Posts

Categories

100 Python Programs for Beginner (119) AI (355) Android (25) AngularJS (1) API (2) Assembly Language (2) aws (31) Azure (12) BI (10) book (1) Books (359) Bootcamp (18) C (78) C# (12) C++ (83) cloud (1) Course (96) Coursera (306) Cybersecurity (37) data (10) Data Analysis (48) Data Analytics (31) data management (16) Data Science (442) Data Strucures (21) Deep Learning (226) Django (17) Downloads (3) edx (21) Engineering (15) Euron (30) Events (9) Excel (24) Finance (13) flask (4) flutter (1) FPL (17) Gadgets (1) Generative AI (79) Git (14) Google (55) Hadoop (3) HTML Quiz (1) HTML&CSS (48) IBM (43) IoT (3) IS (25) Java (99) Leet Code (4) Machine Learning (416) Meta (24) MICHIGAN (5) microsoft (13) Nvidia (8) Pandas (16) PHP (20) Projects (35) Python (1398) Python Bug (1) Python Coding Challenge (1289) Python Library (28) Python Mathematics (22) Python Mistakes (51) Python Pattern Challenge (33) python quixz (1) Python Quiz (670) Python Tips (114) Questions (3) R (72) React (7) Scripting (3) security (5) Selenium Webdriver (4) Software (21) SQL (56) Udemy (24) UX Research (1) web application (11) Web development (9) web scraping (3)

Followers

Python Coding for Kids ( Free Demo for Everyone)