Search⌘ K
AI Features

Solution: Multiplication Table for a Given Number

Understand how to generate a multiplication table for any given number in Python by utilizing a for loop with the range function. Learn to control repetition with looping constructs and produce formatted output effectively.

We'll cover the following...

The solution to the problem of printing the multiplication table for a number is given below.

Solution

Python 3.8
num, lower, upper = 5, 1, 4
for i in range(lower, upper + 1) :
print(num, 'x', i , '=' , num * i)
...