Mini Project: Shopping List Manager

Project Overview:

We will create a Python program that allows users to manage a shopping list. Users will be able to add items, remove items, and view their list.


Project Requirements:

User Input:

  1. The name of the item to add to the shopping list.
  2. The name of the item to remove from the shopping list (if applicable).

Conditional Statements:

  • Before removing an item, the program will check if the item exists in the list and display an appropriate message if it does not.
  • The program will inform the user if the list is empty when attempting to view or modify it.

Output:

  1. A confirmation message when an item is successfully added or removed.
  2. A summary of the current shopping list
  3. A message when exiting the program.


Lesson 2

Learning Intention:

  • I can convert my decision tree in to a functioning python program.
  • I understand how to use a main loop to have my program run until the user terminates it
  • I understand how to use functions to break my program in to clear sections for efficiency and usability. 

 

Activity Description Assessment Criteria
Program Implementation

We can implement our shopping list program by coding each section as its own function.

  1. We need a function to display the menu
  2. We need a function to add items to the list
  3. We need a function to remove items from the list
  4. We need a function to print the list for the user.

We also need a main loop which will continue to run our program until the user chooses to exit.

 

Creating functions and the main loop

In order to create the functions and the game loop we will need to name each function and give it some basic code to execute so we can see that it is working. The below code shows how to set up your 4 functions. Remember these functions won't run until they are called. That's the next step.

image.png

Now that we have these functions we need to set up a loop that will continuously run our program until the user chooses to exit. At the top of the program i'm going to create a variable called "exit" and set it to false.

image.png
Now I can run a loop that will continue to run only while the "app_running" variable is true. The below code shows how the loop would run and then terminate if the user chose option 4. However there are some errors in this code we will need to work our way through. We'll also need to add our other functions in the conditional statement.

image.png

For the rest of the lesson work with your teacher to get your main loop functioning properly and include your remaining menu options in the loops conditional statement.

Next lesson we will finish the shopping list.

proficient implementation of a program that includes functioning and purposeful use of iteration, conditional statements, functions, variables and user input.