Shopping List App

Remember to Do Pair Programming Swaps
list {apples, bread, yogurt, spinach, bananas, eggs, cucumber, tomatoes, olive oil, almonds}
Next round, make gif match project --MF

Many computer apps—contact lists, playlists, calendars of events, locations on a map, reminders—involve manipulating lists of information with tools that search, sort, or change the items on the list. In this first activity, you'll create a Shopping List app.

animation of shopping list app
You've worked with lists before. In this unit you will learn more about this powerful data structure. Lists can contain letters or words, as you've seen before, or lists, as you'll see in this unit, or even blocks, as you'll see in Unit 6. When you used map with lists in Unit 1, it worked with all the items in a list. You can also select a specific item in a list by specifying its position by number. That number is called the index.
item (2) of (list () (cantaloupe) (banana)) reporting 'cantaloupe'
  1. Load this project.
  2. Make a variable called shopping list to store the information.
  3. Setting the starting value of a variable is known as initializing the variable.
  4. Use set block to set the starting value of shopping list to be an empty list. You will need the list block list block. Use its arrows to get rid of its input slot so that it looks like this: empty list block.
Some block input slots expect a list as input. You can tell because the input slot looks kind of like a list:
all but first of item of picture of 2-item list
    You first saw the ask and answer blocks in Unit 2: Using Multiple If Statements and Developing a Number Guessing Game.
  1. Write a script for the "Add Item" button so that when that sprite is clicked, it will ask the user for a new item, and then add the new item to the grocery list.You can use the add or insert list block to modify the list. Make sure it works.
  2. Write a script for the "Clear List" button that asks for confirmation and then sets the variable back to an empty list.
  3. Now Is a Good Time to Save
 
  1. Improve the "Add Item" button to add new items only if they are not already on the list. You can use contains to see if an item is already on the list.
  2. Write a script for the "Search" button that tells the user whether an item is already on the list (but doesn't add the item).
  3. Write a script for the "Delete Item" button that removes an item from the list.
  4. Think of another improvement and program it.