A Day to The Supermarket

screenshot-62

Today we were working on a project called ” a day to the supermarket” in code academy, using the python programming language. Now, i want to explain you how did i do the work successfully hoping that you will fully understand everything

screenshot-63

here we are setting our program using for to just be familiar with it and understand how to use it before we start our program.

screenshot-64

all of these stuffs is just like a preview to just show you how to use for loop because we going to apply them later in our program.

screenshot-66

” a day to the super market” i am creating a variable (prices ) as a list name which has banana apple orange as key. each of the key have a value.

screenshot-65

like any supermarket i am setting my stock. all of these value represent the amount number of the item in the stock.

screenshot-67

like i said earlier we going to apply the for loop here to print out each item’s quantity in the stock and its price.

screenshot-68

again i am using for loop to calculate overall item’s prices and the total.

screenshot-71

this is another section. after i am done with calculating the quantity and the price of my item, i am creating a new variable (groceries) which is a name of a new list.

screenshot-73

we create a variable total after defining the function compute_bill, so we would know determine how much item will left once one is bought.

screenshot-74

in this case we use for loot to iterate through the item and if statement to make the work automatic. each time an item is taken it decreases one from such item value until.

screenshot-69 screenshot-70 screenshot-72