A Day At The Supermarket

First we were given a list of names and we had to use a for loop to print out all of the elements in the list names.

image

Next we used a for loop to go through webster dictionary and print out all the definitions.

image
Here we had to loop through each item in the list called a.

Next we had to write a function called fizz_count that takes a list x as input.

Meaning: def fizz_count(x):image

Create a stock dictionary with the values:

“banana” : 6

“”Apple” : 0

“orange” : 32

“pear” : 15

image

Loop through each key in prices. For each key, print out the key along with its price and stock information. This one took me a little while but only because everything had to be written in specific ways. Everything is very case and space sensitive.

image

The next section had a lot of steps so i will list them below:

Create a variable called total and set it to zero.
Loop through the prices dictionaries.
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 tototal.
Finally, outside your loop, print total.

image

Next, make a list called groceries with the values “banana, orange, and apple”.

image

Define a function compute_bill that takes one argument food as input. Then in that function, create a variable total with an initial value of zero. For each item in the food list, add the price of that item to total. Lastly, return the total.

image

The last slide was just something to revise.

This was our day at the supermarket