这让我困了很久,有人能帮帮我吗? 用粗体突出显示的东西是我需要帮助的东西,请尽量坚持使用格式!
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**
范围将从数字(从0到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的乘积值。