I’ve to write a function that should print multiplication table of number X .That means if i input 5 then, this function should print the multiplication table of 5.
Like that,
5 x 1 = 5
5 x 2 = 10
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
5 x 11 = 55
5 x 12 = 60
But i have to remember the condition that,if i don’t input anything then it should print the multiplication table of 1
Here is my code,
def namata(m):
if m == False:
for i in range(10):
print(1,"x",i+1,"=",1*(i+1))
else:
for i in range(10):
print(m,"x",i+1,"=",m*(i+1))
number = int(input())
print(namata(number))
i did first part correctly, but how i’ll show multiplication table of 1,when function don’t take anything as input?