Learn
A Day at the Supermarket
Something of Value

For paperwork and accounting purposes, let’s record the total value of your inventory. It’s nice to know what we’re worth!

Instructions

1.

Let’s determine how much money you would make if you sold all of your food.

  • Create a variable called total and set it to zero.
  • Loop through the prices dictionary.
  • For each key in prices, multiply the number in prices by the number in stock. Print that value into the console and then add it to total.
  • Finally, outside your loop, print total.
Folder Icon

Take this course for free

Already have an account?