Sección 1. Capítulo 10
single
Challenge: Inventory Sorting Capstone
Desliza para mostrar el menú
Tarea
Desliza para comenzar a programar
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>.
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 1. Capítulo 10
single
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla