[Python] Creating the multiplication table

Discussão em 'Python' iniciado por Stack, Janeiro 26, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to create a multiplication table. The user enters their list of numbers and the program spits out the multiplication for each number. for example,

    3 x 1 = 3
    3 x 2= 6
    3 x 3 = 9
    ......
    .....
    3 x 12=42


    this is what I have tried so far:

    enter code here
    N = int(input("How many numbers would you like to multiply?:"))
    num = []
    q=1
    p = 1
    count=0



    for i in range(0,N):
    add = int(input(f"number {i}:"))
    num.append(add)
    print(num)



    for j in num:
    while q <= 12:
    print (j * q, end=" ")
    q+=1

    #The result is
    How many numbers would you like to multiply?:3
    number 0:2
    number 1:6
    number 2:5
    [2, 6, 5]
    2 4 6 8 10 12 14 16 18 20 22 24
    enter code here


    How do I get the program to spit out all the multiplication for every number in the list?

    Continue reading...

Compartilhe esta Página