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

Зміст курсу

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.

Завдання

  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.

Завдання

  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.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 5. Розділ 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.

Завдання

  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.

Завдання

  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.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 5. Розділ 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.

Завдання

  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.

Завдання

  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.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

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.

Завдання

  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.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 5. Розділ 8
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt