Your task for today is to build a multiplication table grid using nested for
loops. This project will strengthen your understanding of nested iteration and help you practice basic formatting in printed output.
📝 Project Task
The program should:
Ask the user for a table size (e.g., 5 means a 5x5 table).
Use nested for loops to generate and display the multiplication table.
Format the table for aligned columns using
str.ljust()
orf-strings
.
Bonus (optional):
Highlight the diagonal (e.g., square numbers).
Allow the user to choose between rows × columns or columns × rows.
This project helps you visualize how outer and inner loops interact — a key concept for working with grids, 2D arrays, or drawing shapes.
📌 Expected Output
Example for size = 5:
💬 Join the Weekly Python Chat
Need help or want to share what you built? Join this week’s Python Chat Thread to:
Ask questions
Share your solution
Get feedback
Find study partners
💻 Launch This Project in Colab
Open the interactive Google Colab notebook for today’s project — with full instructions, hints, and solutions.
Click the button below to start coding — no setup needed:
First one of these i've done, was fun, curious about best place to show off code without spoiling a solution for others.
1. Helped me revise nested for loops & their flow of execution.
2. Made me realise that it is good to create an extra variable to avoid cluttering. This was useful for highlighting the square diagonals.
3. Got to know about the .ljust(), .center() & .rjust() str methods to ajdust alignment.
4. Got to know how to adjust similar alignments in f-string using <,^,>