So im trying to create a times table:
Write a program to print a multiplication table (a times table). At the start, it should ask the user which table to print and how high the table should go.
The output should look something like this:
Which multiplication table would you like?
5
How High?
10
Here’s your table:
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
but my code just keeps running infinitely
(EXAMPLE OF INFINITE OUTPUT)
Which multiplication table would you like:
None7
How high
None9
Heres your table 7 X 9 =
Heres your table 7 X 9 =
Heres your table 7 X 9 =
Heres your table 7 X 9 =
" "
EXAMPLE OF CODE:
num1 = int(input(print("Which multiplication table would you like: ")))
num2 = int(input(print("How high")))
total = 1
while total != 0:
total = num1 * num2
print("Heres your table", num1, 'X', num2, '=')