Python program that displays the multiplication table of a given number:
number = int(input("Enter a number: "))
# Display the multiplication table
for i in range(1, 11):
print(number, "x", i, "=", number*i)
The program prompts the user to enter a number using the input() function, and stores the value in the variable “number”. It then uses a for loop to iterate through the range of numbers from 1 to 11 and for each number, it multiplies it with the entered number and prints the result.
Another way to display the multiplication table is by using a while loop:
number = int(input("Enter a number: "))
i = 1
while i <= 10:
print(number, "x", i, "=", number*i)
i += 1
Here, it takes input from the user for a number and using a while loop it iterates from 1 to 10, and for each iteration, it multiplies the entered number with the current iteration number and prints the result.
Both methods will give you the same output which is the multiplication table of the entered number. You can use any method that suits your need or preference.