【发布时间】:2021-07-01 14:26:12
【问题描述】:
我正在尝试创建一个乘法表。用户输入他们的数字列表,程序会输出每个数字的乘法。例如,
3 x 1 = 3
3 x 2= 6
3 x 3 = 9
......
.....
3 x 12=42
这是我迄今为止尝试过的:
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
如何让程序输出列表中每个数字的所有乘法?
【问题讨论】:
标签: python multiplication