Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Challenge: Inventory Sorting Capstone | Variables and Types
Introduction to Python (copy)
course content

Kursinnehåll

Introduction to Python (copy)

Introduction to Python (copy)

1. Getting Started
2. Variables and Types
3. Conditional Statements
4. Other Data Types
5. Loops
6. Functions

book
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.

Uppgift

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 items string to extract:
    • "Bubblegum"candy1
    • "Chocolate"candy2
    • "Pasta"dry_goods
  • Slice the categories string 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>

Lösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 2. Kapitel 7
toggle bottom row

book
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.

Uppgift

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 items string to extract:
    • "Bubblegum"candy1
    • "Chocolate"candy2
    • "Pasta"dry_goods
  • Slice the categories string 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>

Lösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 2. Kapitel 7
Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Vi beklagar att något gick fel. Vad hände?
some-alt