Lab #8: A Day at the Supermarket!

 

During today’s lab, we continued learning to use list along with a new data type, dictionaries. The dictionary basically sounds how it should work. Find the word, get the definition. In this case, find the key, return the value that it hold. In the end we were able to create a bill compueter

In the beginning, we created a list of prices that are along with the items those prices are for.Capture

Then we created another list with the same items except its keeping track of the stocks of those items.Capture1

Afterwards, we tested out if the newly created dictionaries are okay so we printed them in a for loop.Capture2

Then we printed the total value of prices this store holds.Capture3

Now we take a quick break worrying about the store and think about what we are going to buy, we we made a shopping list.Capture4

Using the shopping list, we create a function that will calculate our total bill for when we buy them later.Capture5

We have to fix this up a bit since there might be items not in stock, so we have to test for in stock items, then we subtract one from that stock if its available. And is all we need to make a shopping list calculator.Capture6