Question 24: List Elements with Input

πŸ›’ Class Activity: My Mini Snack Shop

πŸ§ƒ Part 1: Add Snacks to Your Shop

You are opening a small snack shop.

  1. Start with an empty snack list.

  2. Ask the user to type the name of a snack.

  3. Add the snack to the list.

  4. Do this three times for other snacks to add too.

After adding three snacks:

πŸ‘‰ Print the snack list.

Sample output message:

Your snack list is: ['Chips', 'Biscuits', 'Juice']

βž• Part 2: More Snacks Arrived!

  1. Count how many snacks are already in your list.

  2. Ask the user:
    β€œHow many new snacks arrived?”

  3. Use + to add this number to the number you already have.

πŸ‘‰ Print the total number of snacks.

Sample output message:

You now have 5 snacks in your shop.

Example thinking:
If you had 3 snacks and 2 more arrived
3 + 2 = 5


βž– Part 3: Some Snacks Were Sold

  1. Ask the user:
    β€œHow many snacks were sold today?”

  2. Use βˆ’ to subtract this number from your total.

πŸ‘‰ Print how many snacks are left.

Sample output message:

You have 3 snacks left.

Example:
5 βˆ’ 2 = 3


πŸ—‘οΈ Part 4: Remove a Snack

  1. Ask the user:
    β€œEnter the snack number you want to remove.”

  2. Remove that snack from the list.

πŸ‘‰ Print the updated snack list.

Sample output message:

Updated snack list: ['Chips', 'Juice']

✏️ Part 5: Change a Snack Name

  1. Ask:
    β€œEnter the snack number you want to change.”

  2. Ask:
    β€œEnter the new snack name.”

  3. Replace the old snack with the new one.

πŸ‘‰ Print the updated snack list.

Sample output message:

Updated snack list: ['Chips', 'Cake', 'Juice']

🏁 Final Question

If you have:

  • 4 snacks

  • You add 3

  • Then 2 are sold

πŸ‘‰ Print the final answer.

Sample output message:

You have 5 snacks left.
Write what you are looking for, and press enter to begin your search!