So I'm making a basic table generator that will take a number from the user and print the table using for loop using the range function:
n = int(input('Enter number for table'))
for i in range(1,11):
# print(n*i, '\n')
print(n + "" + i + "=" + n*i)
I want the table to be printed in the following format:
e.g: 5*4=20
I'm writing print(n + "*" + i + "=" + n*i)
.
Here n
is the user given number for which table is required and i
is from for loop but the program returns an error saying can not concatenate str and int.
I'm new to python I'm coming from C++ it was easy in C++ to write these sorts of statements but I don't know how to do it in python.
Thank you