Challenge: Inventory Sorting Capstone
Great job mastering variables, data types, slicing, and concatenation!
Now, let's apply your new skills to a realistic scenario involving organizing new grocery store inventory.
Swipe to start coding
Manage a grocery store inventory by extracting item names and categories using string slicing, assigning prices, and printing formatted statements.
- Slice the
itemsstring to extract:"Bubblegum"→candy1"Chocolate"→candy2"Pasta"→dry_goods
- Slice the
categoriesstring to extract:"Candy Aisle"→category1"Pasta Aisle"→category2
- Create price variables:
bubblegum_price="$1.50"chocolate_price="$2.00"pasta_price="$5.40"
- Use
print()to display item names, prices, and categories.
Output Requirements
Print the following:
We have <candy1> for <bubblegum_price> in the <category1>We have <candy2> for <chocolate_price> in the <category1>We have <dry_goods> for <pasta_price> in the <category2>
Solution
Thanks for your feedback!
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Can you give me an example of how to organize grocery store inventory using these concepts?
What kind of data should I use for the inventory scenario?
Can you walk me through a sample problem related to grocery inventory?
Awesome!
Completion rate improved to 2.08
Challenge: Inventory Sorting Capstone
Swipe to show menu
Great job mastering variables, data types, slicing, and concatenation!
Now, let's apply your new skills to a realistic scenario involving organizing new grocery store inventory.
Swipe to start coding
Manage a grocery store inventory by extracting item names and categories using string slicing, assigning prices, and printing formatted statements.
- Slice the
itemsstring to extract:"Bubblegum"→candy1"Chocolate"→candy2"Pasta"→dry_goods
- Slice the
categoriesstring to extract:"Candy Aisle"→category1"Pasta Aisle"→category2
- Create price variables:
bubblegum_price="$1.50"chocolate_price="$2.00"pasta_price="$5.40"
- Use
print()to display item names, prices, and categories.
Output Requirements
Print the following:
We have <candy1> for <bubblegum_price> in the <category1>We have <candy2> for <chocolate_price> in the <category1>We have <dry_goods> for <pasta_price> in the <category2>
Solution
Thanks for your feedback!
single