完成以下算法,以以下格式计算和打印每个产品在三个月内的总销售额:



这让我陷入困境多年,有人能帮我吗?粗体突出显示的内容是我需要帮助的内容,请尝试坚持格式!

Total for product 1: xx
Total for product 2: xx
etc [3]
sales = [
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0]
]
totalsales = [0,0,0,0,0]
for product  = 0 to 4
print("Sales for product", product + 1)
for month = 0 TO 2
sales[month][product]  =  input("Enter quantity for month ", month + 1,":") 
**insert code here**

next month
next product
**insert code here**

范围将采用从数字到N的序列,因此:

for product in range(5):
print("Sales for product", product + 1)
for month in range(3):
sales[month][product]  =  input("Enter quantity for month ", month + 1,":") 

将迭代 0,1,2,3,4 中的乘积值。

最新更新