Phase 2 - Level 4: Pattern Printing
Master nested loops to print various patterns.
13 programs · open one, then the next
Start with Print Right Triangle Pattern- 01Print Right Triangle PatternIntermediatePrint a growing right triangle of stars with Python nested loops. Students map the outer loop to rows and the inner loop to a row's exact character count.Open example →py# Take n n = int(input("Enter number of rows: ")) # Print right triangle
- 02Print Inverted Right TriangleIntermediatePrint a shrinking right triangle of stars in Python. Students trace a descending row width and keep the newline outside the inner character-printing loop.Open example →py# Take n n = int(input("Enter number of rows: ")) # Print inverted triangle
- 03Print Pyramid PatternIntermediateCenter a solid star pyramid with Python loops. Students calculate leading spaces and odd star counts, then trace the separate newline that completes each row.Open example →py# Take n n = int(input("Enter number of rows: ")) # Print pyramid
- 04Number Pattern 1IntermediatePrint an increasing digit triangle with Python nested loops. Students distinguish column values from row values and predict why numbering restarts on every row.Open example →py# Take n n = int(input("Enter number of rows: ")) # Print pattern
- 05Number Pattern 2IntermediatePrint rows of repeated numbers with Python nested loops. Students compare row and column roles and see why the same row value appears several times per line.Open example →py# Take n n = int(input("Enter number of rows: ")) # Print pattern
- 06Character PatternIntermediateBuild an alphabet triangle with chr and nested loops. Students trace character codes, row-local counting, and why letters continue past Z for large sizes.Open example →py# Take n n = int(input("Enter number of rows: ")) # Print pattern
- 07Print Hollow SquareIntermediateDraw a compact hollow square with Python border conditions. Students trace zero-based row and column indexes and print interior spaces without cell separators.Open example →py# Take n n = int(input("Enter size: ")) # Print hollow square
- 08Print Diamond PatternIntermediatePrint a star diamond using two print calls per row. Students trace string repetition, the separate indentation call, and a lower half that skips the widest row.Open example →py# Take n n = int(input("Enter number of rows: ")) # Upper half
- 09Mirrored Number PyramidIntermediateCreate a mirrored number pyramid with Python loops. Students print ascending then descending digits, avoid repeating the center, and account for leading spaces.Open example →py# Take n n = int(input("Enter number of rows: ")) # Print number pyramid
- 10Floyd TriangleIntermediatePrint Floyd's triangle with a counter shared across rows. Students trace Python nested loops and distinguish a persistent number from a reset column index.Open example →py# Take n n = int(input("Enter number of rows: ")) # Print Floyd triangle
- 11Diamond PatternIntermediateAssemble each star-diamond row as one Python string. Students combine spaces and stars, then build two halves without printing the widest row twice.Open example →py# Take n n = int(input("Enter n: ")) # Upper half
- 12Ascending Number Pyramid with Spaced ValuesIntermediatePrint an ascending number pyramid with spaces between values. Students follow Python nested loops and distinguish this layout from a mirrored digit pyramid.Open example →py# Take n n = int(input("Enter n: ")) # Print pyramid
- 13Hollow Square PatternIntermediatePrint a hollow square using spaced cells in Python. Students trace the four border tests and see how trailing spaces affect the width of each output row.Open example →py# Take n n = int(input("Enter n: ")) # Print hollow square