Python program to print multiplication table
Description: Write a Python program to print the multiplication table of a number.
Rules and hints:
- Use a
forloop withrange(1, 11). - Print each line in the form
7 x 1 = 7.
Python program for multiplication table
num = 7
for i in range(1, 11):
print(f"{num} x {i} = {num * i}")
Output:
Tutorials Class - Output Window
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
How it works
range(1, 11)gives the numbers 1 to 10. The end value 11 is not included.- In each round the f-string puts the values of
num,iand the product in the line.
Learn more in Python for loop.
Learn more about the similar topics:
| Tutorials |
|---|
| No Content Found. |
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |