Founding Batch Offer · HLD · LLD · System Design at ₹799 until 30 Nov

ProgramsLogic building

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
  1. 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 →
  2. 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 →
  3. 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 →
  4. 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 →
  5. 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 →
  6. 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 →
  7. 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 →
  8. 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 →
  9. 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 →
  10. 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 →
  11. 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 →
  12. 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 →
  13. 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 →