> For the complete documentation index, see [llms.txt](https://www.pythonclassroom.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.pythonclassroom.com/lists/lists-strings/shopping.md).

# Shopping Project

## Video Lecture

{% embed url="<https://youtu.be/SW3A-S3IgiI>" %}

## Problem

You want to go shopping for computers and electronics.  Create two lists.  One for the name of the items and other for the cost of the items. &#x20;

* Create a menu item S that lists the items for sale and the cost
* Create a menu item P that asks the user for 3 items to purchase and their prices.
* Create a menu item C that print the items the user purchases and the total price.
* Create a menu item Q that quits the program.

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-M8ChA93Gk4bRDI3x20Z%2F-M8Chk7345EpU-XWWiUk%2Fimage.png?alt=media\&token=5b48b7a1-4f62-4c71-8e5d-d5bfb163b645)

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-M8CeWReeBgyg8GjT6sA%2F-M8CfeE37CDnKgWtvyii%2Fimage.png?alt=media\&token=312a904e-677c-4667-803c-faef3d951e4d)

![Source: Best Buy](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-M8CeWReeBgyg8GjT6sA%2F-M8CfvgJF_tePDRpVJpX%2Fimage.png?alt=media\&token=dea4d9e4-afbb-4d64-9619-fb34ca3c7bb0)

## Example Code

```python
shopping_list = []
shopping_cost = []
done = False
while not done:
    print("Shopping Program")
    print("S - Shop")
    print("P - Purchase")
    print("C - Checkout")
    print("Q - Quit")
    choice = input("Choice: ")
    if choice == "S":
        print("Items available to purchase")
        print("Animal Crossing $59.99")
        print("Skullcandy Headphones $29.99")
        print("Beats by Dr Dre $199.99")
        print("HP 15.6\" touchscreen laptop $499.99")
        print("ASUS 14\" touchscreen laptop $599.99")
        print("Samsung 13.3\" touchscreen laptop $849.99")
        print("HP ENVY x360 $799.99")
    elif choice == "P":
        for x in range(3):
            add_shopping_list = input("Name of Item: ")
            shopping_list.append(add_shopping_list)
            add_shopping_cost = float(input("Cost of Item: "))
            shopping_cost.append(add_shopping_cost)
    elif choice == "C":
        print("Items Purchased")
        for x in shopping_list:
            print(x)
        print("Total: ",sum(shopping_cost))
    elif choice == "Q":
        print("Quitting")
        done = False
    else:
        print("Invalid Choice")
        
```

### Sample Output

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-M8MVHaUXqorP8QqfxmV%2F-M8MW0YZRNOC2lWdZ39P%2Fimage.png?alt=media\&token=f9e6fd59-820d-4e3b-8335-bd6d6321c9e0)

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-M8MVHaUXqorP8QqfxmV%2F-M8MW9X0A2atUih-6neL%2Fimage.png?alt=media\&token=ab11892d-35e0-4a44-9006-1a7472ce6a8c)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.pythonclassroom.com/lists/lists-strings/shopping.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
