how to make a for loop do the 2 times table in pytho code example

Example 1: write a python program to find table of a number using while loop

a=int(input("enter table number"))
b=int(input("enter the number to which table is to printed"))
i=1
while i<=b:
    print(a,"x",i,"=",a*i)
    i=i+1

Example 2: print multiplication table python

# Multiplication table (from 1 to 10) in Python

num = 12

# To take input from the user
# num = int(input("Display multiplication table of? "))

# Iterate 10 times from i = 1 to 10 By AyushG
for i in range(1, 11):
   print(num, 'x', i, '=', num*i)

Tags:

Java Example