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
3 Antworten
+ 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)))
0
Can U tell me more?
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))