Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge | Loops
Introduction to Python Video Course
course content

Contenido del Curso

Introduction to Python Video Course

Introduction to Python Video Course

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

Challenge

In this challenge, you'll need to apply your knowledge of for and while loops to manage a grocery store's inventory; specifically, you need to update stock quantities and monitor the shelf life of a specific product.

Tarea

  1. Iterate Over products: Use the for keyword to iterate over the products dictionary. Use the items() method to access both the key product and the value stock.
  2. Check Stock Levels: Within the loop, check if the stock quantity of any product is less than 20 units.
  3. Initialize apples_stock Variable: Initialize the apples_stock variable by using the key "Apples" to access the stock quantity in the products dictionary.
  4. Initialize the while Loop: Use the while keyword to initialize the loop.
  5. apples_stock Counter: Use the apples_stock counter variable to decrease the stock by 5 units during each iteration.
  6. days Counter: Use the days counter variable to increase the days by 1 during each iteration.

Tarea

  1. Iterate Over products: Use the for keyword to iterate over the products dictionary. Use the items() method to access both the key product and the value stock.
  2. Check Stock Levels: Within the loop, check if the stock quantity of any product is less than 20 units.
  3. Initialize apples_stock Variable: Initialize the apples_stock variable by using the key "Apples" to access the stock quantity in the products dictionary.
  4. Initialize the while Loop: Use the while keyword to initialize the loop.
  5. apples_stock Counter: Use the apples_stock counter variable to decrease the stock by 5 units during each iteration.
  6. days Counter: Use the days counter variable to increase the days by 1 during each iteration.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 5. Capítulo 8
toggle bottom row

Challenge

In this challenge, you'll need to apply your knowledge of for and while loops to manage a grocery store's inventory; specifically, you need to update stock quantities and monitor the shelf life of a specific product.

Tarea

  1. Iterate Over products: Use the for keyword to iterate over the products dictionary. Use the items() method to access both the key product and the value stock.
  2. Check Stock Levels: Within the loop, check if the stock quantity of any product is less than 20 units.
  3. Initialize apples_stock Variable: Initialize the apples_stock variable by using the key "Apples" to access the stock quantity in the products dictionary.
  4. Initialize the while Loop: Use the while keyword to initialize the loop.
  5. apples_stock Counter: Use the apples_stock counter variable to decrease the stock by 5 units during each iteration.
  6. days Counter: Use the days counter variable to increase the days by 1 during each iteration.

Tarea

  1. Iterate Over products: Use the for keyword to iterate over the products dictionary. Use the items() method to access both the key product and the value stock.
  2. Check Stock Levels: Within the loop, check if the stock quantity of any product is less than 20 units.
  3. Initialize apples_stock Variable: Initialize the apples_stock variable by using the key "Apples" to access the stock quantity in the products dictionary.
  4. Initialize the while Loop: Use the while keyword to initialize the loop.
  5. apples_stock Counter: Use the apples_stock counter variable to decrease the stock by 5 units during each iteration.
  6. days Counter: Use the days counter variable to increase the days by 1 during each iteration.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 5. Capítulo 8
toggle bottom row

Challenge

In this challenge, you'll need to apply your knowledge of for and while loops to manage a grocery store's inventory; specifically, you need to update stock quantities and monitor the shelf life of a specific product.

Tarea

  1. Iterate Over products: Use the for keyword to iterate over the products dictionary. Use the items() method to access both the key product and the value stock.
  2. Check Stock Levels: Within the loop, check if the stock quantity of any product is less than 20 units.
  3. Initialize apples_stock Variable: Initialize the apples_stock variable by using the key "Apples" to access the stock quantity in the products dictionary.
  4. Initialize the while Loop: Use the while keyword to initialize the loop.
  5. apples_stock Counter: Use the apples_stock counter variable to decrease the stock by 5 units during each iteration.
  6. days Counter: Use the days counter variable to increase the days by 1 during each iteration.

Tarea

  1. Iterate Over products: Use the for keyword to iterate over the products dictionary. Use the items() method to access both the key product and the value stock.
  2. Check Stock Levels: Within the loop, check if the stock quantity of any product is less than 20 units.
  3. Initialize apples_stock Variable: Initialize the apples_stock variable by using the key "Apples" to access the stock quantity in the products dictionary.
  4. Initialize the while Loop: Use the while keyword to initialize the loop.
  5. apples_stock Counter: Use the apples_stock counter variable to decrease the stock by 5 units during each iteration.
  6. days Counter: Use the days counter variable to increase the days by 1 during each iteration.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

In this challenge, you'll need to apply your knowledge of for and while loops to manage a grocery store's inventory; specifically, you need to update stock quantities and monitor the shelf life of a specific product.

Tarea

  1. Iterate Over products: Use the for keyword to iterate over the products dictionary. Use the items() method to access both the key product and the value stock.
  2. Check Stock Levels: Within the loop, check if the stock quantity of any product is less than 20 units.
  3. Initialize apples_stock Variable: Initialize the apples_stock variable by using the key "Apples" to access the stock quantity in the products dictionary.
  4. Initialize the while Loop: Use the while keyword to initialize the loop.
  5. apples_stock Counter: Use the apples_stock counter variable to decrease the stock by 5 units during each iteration.
  6. days Counter: Use the days counter variable to increase the days by 1 during each iteration.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 5. Capítulo 8
Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
We're sorry to hear that something went wrong. What happened?
some-alt