« All Events
6 PM – Intro To Python – Nathalie – Gamas
August 3, 2023 @ 6:00 pm - 7:00 pm
Today We Did
- We reviewed turtle python project.
- We started Grocery Shopping Cart.
Homework
- Continue with Aug3_GroceryShoppingCart.py
- Make sure if user select “Ice Cream” and “Bread” the program works and the program keeps track of the price of “Ice cream” and “bread”. Similar to what we did with Milk today.
- You also need to be able to keep track of the items that you purchase.
- You need to create a new variable.
- The data type for this variable would be List.
- Everytime user select an “1”,”2″,”3″, make sure to add the item name to the list.
- After you exit, you need to use for loop to go through each element inside the list and list them out one by one. Look at Oct15_ListForLoopHomework.py
- Change your codes so it can do the following. For keeping track the items that you purchase, you have to create a new variable and use List.
-
What do you want to purchase:
1. Milk - $5
2. Ice Cream - $4
3. Bread - $6
Enter your selection. Enter "exit" to checkout: 1
You have purchased Milk for $5
What do you want to purchase:
1. Milk - $5
2. Ice Cream - $4
3. Bread - $6
Enter your selection. Enter "exit" to checkout: 2
You have purchased Ice Cream for $4
What do you want to purchase:
1. Milk - $5
2. Ice Cream - $4
3. Bread - $6
Enter your selection. Enter "exit" to checkout: 3
You have purchased Bread for $6
What do you want to purchase:
1. Milk - $5
2. Ice Cream - $4
3. Bread - $6
Enter your selection. Enter "exit" to checkout: exit
You have purchased the following items:
MILK
ICE CREAM
BREAD
Please pay $15, thank you for your business.