Skip to main content
  • Python is available now. All other compilers are coming soon.

    Python
  • Popular Tutorials

    • Getting Started With Python
    • Python if Statement
    • while Loop in Python
    • Python Lists
    • Dictionaries in Python
    All Python Tutorials

    Reference Materials

    Built-in FunctionsList MethodsDictionary MethodsString Methods
    View all

Online Compilers

  • Python Compiler
  • Python Playground
  • Python Projects
  • Exercises

Tutorials

  • Learn Python
  • Python for Beginners
  • Variables and Types
  • Python Strings
  • Python Lists
  • Python If Else
  • Python For Loops
  • Python Functions
  • Python Classes

Examples

  • Python Examples
  • Hello World
  • Add Two Numbers
  • Even or Odd
  • Factorial
  • Fibonacci
  • Prime Check
  • Palindrome Check

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Use
  • Disclaimer

© 2026 ILoveCompiler. All rights reserved.

  1. Home
  2. Python Examples
  3. Multiplication Table

Loops · Python example

Multiplication Table

Print a ten-row multiplication table with a for loop and range().

Open the compilerAll examples
beginnerfor looprangef-strings

A for loop is ideal when you know how many times to repeat an action. range(1, 11) produces the numbers 1 through 10.

example.py
number = 7

for multiplier in range(1, 11):
    print(f"{number} x {multiplier} = {number * multiplier}")

How the code works

  • range(1, 11) yields 1, 2, ..., 10.
  • For each value, Python formats and prints one row.
  • The loop ends after 10 iterations.

Key ideas

  • range(start, stop) includes start and excludes stop.
  • Each iteration assigns the next value to multiplier.
  • The f-string calculates the product for every row.

Try changing it

  • Ask for the number with input().
  • Print tables from 1 to 5 with a nested loop.
  • Use end=' ' to print several values on one line.

Related examples

beginner

Calculate a Factorial

Multiply numbers in a loop to compute n! with a loop.

beginner

Star Pyramid Pattern

Use spaces and string repetition to print a centred star pyramid.

Previous exampleGrade CalculatorNext exampleCalculate a Factorial

Expected output

7 x 1 = 7
7 x 2 = 14
7 x 3 = 21
7 x 4 = 28
7 x 5 = 35
7 x 6 = 42
7 x 7 = 49
7 x 8 = 56
7 x 9 = 63
7 x 10 = 70

Output is compared after trimming trailing whitespace on each line. Run the code to see it produced by CPython in your browser.

Practice next

Apply the same idea with automatic tests or browse a guided project.

ExercisesProjects