I am a beginner, I'm writing a program to produce the multiplication table of any number y ( entered by the user), how do I print the results as y*i=ans | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I am a beginner, I'm writing a program to produce the multiplication table of any number y ( entered by the user), how do I print the results as y*i=ans

17th Sep 2016, 1:24 PM
POZEIDON Thomas
POZEIDON Thomas - avatar
3 Answers
+ 1
print("Multiplication") a = input("Please enter the first operand: ") print(a) b = input("Please enter the second operand: ") print(b) print(a + "*" + b + " = " + str(int(a)*int(b)))
17th Sep 2016, 2:11 PM
Zen
Zen - avatar
0
Can U tell me more?
17th Sep 2016, 2:02 PM
RcA21
0
y = int (input ("Enter a whole number: ")) #the line above gets input and makes it an int ans = x * y print ("{} × {} = {}".format (x, y, ans)) if you want a full table (like x = 1 all the way to 100) and have every line printed, just put the last 2 lines in a for loop. y = int (input ("Enter a whole number: ")) for x in range (101): #all nums 0-100 ans = x * y print ("{} × {} = {}".format (x, y, ans))
17th Sep 2016, 11:40 PM
Luke Armstrong