Last answered:

16 Aug 2021

Posted on:

14 Aug 2021

0

When I am trying to run the code I get answer as zero. What is wrong with my code ?





for i in prices:
    if prices[i]<5:
        money_spent =+ prices[i] * quantity[i]
    else:
        money_spent = money_spent

print (money_spent)

1 answers ( 0 marked as helpful)
Instructor
Posted on:

16 Aug 2021

0

Hi Taufiq!

Thanks for reaching out.

To assist you better, we would probably need more information. Nevertheless, I suppose that you may have missed executing the previous code cells from your Jupyter Notebook Document. In other words, please double-check if you've managed to successfully assign values to the prices and quantity objects.

Hope this helps but please feel free to get back to us should you need further assistance. Thank you.
Best,
Martin

Submit an answer