1. The assumption of this practice is you already have supermarket_item.py with SupermarketItem class in it.
  2. Create a new python file supermarket_practice.py
  3. Inside the file, create a new class SupermarketPractice
  4. Inside the class, create an __init__ method.
  5. ‘Inside the method create a new class attribute: items_dictionary. Remember since this is a class attribute, you can to prefix with self. This class attribute will be an empty dictionary.
  6. import SupermarketItem class on the top of the file. Look at how we did it in supermarket_system.py.
  7. Create a new method called “initialize_items“. A method is a function inside a class. Since it is a method, it needs to have “self” as the first parameter.
  8. Inside this new method initialize_items add 4 new SupermarketItems into items_dictionary class attribute. Make the name of the item as the key and SupermarketItem as the value.
    1. Apple Juice, $10, Frozen is False.
    2. Banana, $3, Frozen is False.
    3. Fish, $10, Frozen is True.
    4. Frozen Pizza, $20, Frozen is True.
  9. Create a new method, list_affordable_items . Inside this method, loop through each element inside the items_dictionary class attributes and list all items whose price is $10 or less. If you are struggling, look at how we did list_all_teachers in SchoolApplication project. So expected items would be
    1. $10 or less items:
      Apple Juice - $10
      Banana - $3
      Fish - $10
  10. Create an instance of Practice class and call initialize_items methods and then list_affordable_items method. Something like this
    1. sp = SupermarketPractice()