Print Multiplication Table

Print the table of a given number (n × 1 to n × 10).

BeginnerPhase 2 - Level 1: Basic LoopingExample 7 of 14
print-multiplication-table.py
1# Take n as input
2n = int(input("Enter a number: "))
3
4# Print multiplication table
5print(f"Multiplication table of {n}:")
6for i in range(1, 11):
7 result = n * i
8 print(f"{n} × {i} = {result}")

Output

Enter a number: 5
Multiplication table of 5:
5 × 1 = 5
5 × 2 = 10
5 × 3 = 15
...
5 × 10 = 50

What's going on

Loop from 1 to 10, multiply n by each.

Key Concepts:

Loop variable i from 1 to 10
Calculate n * i for each iteration
Print formatted result