Skip to content

04-05: Times Table Generator

Python: Fundamentals

View the live site — ijk37.com

Project 05

Home  |  All Projects  |  Notes  |  Exercises  |  Quiz Hub

Prints multiplication tables in three modes: vertical list, full grid, and interactive quiz. Demonstrates nested loops, range(), and string format alignment.

Topics covered: for loops · nested loops · range() · string format spec (:>5, :<3) · random.shuffle() · input validation · functions

Difficulty: ⭐ Beginner


How to Run

python main.py

Sample Output (Grid mode, 3–5 × 1–6)

═══════════════════════════════════════════════════════════
  Multiplication Grid  (3–5  ×  1–6)
───────────────────────────────────────────────────────────
            1    2    3    4    5    6
───────────────────────────────────────────────────────────
  3  :      3    6    9   12   15   18
  4  :      4    8   12   16   20   24
  5  :      5   10   15   20   25   30
═══════════════════════════════════════════════════════════

Key Concepts Practised

Concept Where used
for + range() Building each table row
Nested for Grid: outer = row number, inner = multiplier
f-string alignment (:>5) Grid column padding
random.shuffle() Randomising quiz question order
int() + try/except Input validation