Learn about Print Multiplication Table in Python in the below code example. Also, refer to the comments in the code snippet to get a detailed view about what’s actually happening.
Contents
Print Multiplication Table in Python
The below program prints the Multiplication table for the given number using a for Loop.
# Python program to print multiplication table
# input number
num = int(input('print multiplication table of: '))
# print multiplication table
for i in range(1, 11):
print ("%d * %d = %d" % (num, i, num * i))
Output:
print multiplication table of: 3 3 * 1 = 3 3 * 2 = 6 3 * 3 = 9 3 * 4 = 12 3 * 5 = 15 3 * 6 = 18 3 * 7 = 21 3 * 8 = 24 3 * 9 = 27 3 * 10 = 30
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Code : Print Even and Odd numbers from 1 to 100 in Python