write a program to print table of any number in python using for loop
Answers
Explanation:
Python Program to Display the multiplication Table
num = int(input("Show the multiplication table of? "))
# using for loop to iterate multiplication 10 times.
for i in range(1,11):
print(num,'x',i,'=',num*i)
Answer:
python syntax
Explanation:
- A for loop in python programming language. The for loop is a string used for iterations of sequences related to list, tuple, dictionary, strings or sets.
- The for keyword in python, is used as an iterator for also other object oriented programming languages.
- The for loop is used for executing the sets of statements.
The basic syntax for loop in python:
for [any item] in [in any sequence]:
Given that:
Writing the program to print table of any number in python using for loop
num = int(input ("Enter the num of which the user wants to print the multiplication table: "))
# We are using "for loop" to iterate the multiplication 30 times
print ("The Multiplication Table of: ", number)
for count in range(3, 11):
print (num, 'b', count, '=', num * count)
output:
Enter the number of which the user wants to print the multiplication table: 5
The Multiplication Table of: 5
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50
#SPJ3
num = int(input("Show the multiplication table of? "))
# using for loop to iterate multiplication 10 times.
for i in range(1,11):
print(num,'x',i,'=',num*i)