Course Content
Introduction to Python Video Course
Introduction to Python Video Course
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.
Task
- Iterate Over
products
: Use thefor
keyword to iterate over theproducts
dictionary. Use theitems()
method to access both the keyproduct
and the valuestock
. - Check Stock Levels: Within the loop, check if the stock quantity of any product is less than
20
units. - Initialize
apples_stock
Variable: Initialize theapples_stock
variable by using the key"Apples"
to access the stock quantity in theproducts
dictionary. - Initialize the
while
Loop: Use thewhile
keyword to initialize the loop. apples_stock
Counter: Use theapples_stock
counter variable to decrease the stock by5
units during each iteration.days
Counter: Use thedays
counter variable to increase the days by1
during each iteration.
Task
- Iterate Over
products
: Use thefor
keyword to iterate over theproducts
dictionary. Use theitems()
method to access both the keyproduct
and the valuestock
. - Check Stock Levels: Within the loop, check if the stock quantity of any product is less than
20
units. - Initialize
apples_stock
Variable: Initialize theapples_stock
variable by using the key"Apples"
to access the stock quantity in theproducts
dictionary. - Initialize the
while
Loop: Use thewhile
keyword to initialize the loop. apples_stock
Counter: Use theapples_stock
counter variable to decrease the stock by5
units during each iteration.days
Counter: Use thedays
counter variable to increase the days by1
during each iteration.
Everything was clear?
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.
Task
- Iterate Over
products
: Use thefor
keyword to iterate over theproducts
dictionary. Use theitems()
method to access both the keyproduct
and the valuestock
. - Check Stock Levels: Within the loop, check if the stock quantity of any product is less than
20
units. - Initialize
apples_stock
Variable: Initialize theapples_stock
variable by using the key"Apples"
to access the stock quantity in theproducts
dictionary. - Initialize the
while
Loop: Use thewhile
keyword to initialize the loop. apples_stock
Counter: Use theapples_stock
counter variable to decrease the stock by5
units during each iteration.days
Counter: Use thedays
counter variable to increase the days by1
during each iteration.
Task
- Iterate Over
products
: Use thefor
keyword to iterate over theproducts
dictionary. Use theitems()
method to access both the keyproduct
and the valuestock
. - Check Stock Levels: Within the loop, check if the stock quantity of any product is less than
20
units. - Initialize
apples_stock
Variable: Initialize theapples_stock
variable by using the key"Apples"
to access the stock quantity in theproducts
dictionary. - Initialize the
while
Loop: Use thewhile
keyword to initialize the loop. apples_stock
Counter: Use theapples_stock
counter variable to decrease the stock by5
units during each iteration.days
Counter: Use thedays
counter variable to increase the days by1
during each iteration.
Everything was clear?
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.
Task
- Iterate Over
products
: Use thefor
keyword to iterate over theproducts
dictionary. Use theitems()
method to access both the keyproduct
and the valuestock
. - Check Stock Levels: Within the loop, check if the stock quantity of any product is less than
20
units. - Initialize
apples_stock
Variable: Initialize theapples_stock
variable by using the key"Apples"
to access the stock quantity in theproducts
dictionary. - Initialize the
while
Loop: Use thewhile
keyword to initialize the loop. apples_stock
Counter: Use theapples_stock
counter variable to decrease the stock by5
units during each iteration.days
Counter: Use thedays
counter variable to increase the days by1
during each iteration.
Task
- Iterate Over
products
: Use thefor
keyword to iterate over theproducts
dictionary. Use theitems()
method to access both the keyproduct
and the valuestock
. - Check Stock Levels: Within the loop, check if the stock quantity of any product is less than
20
units. - Initialize
apples_stock
Variable: Initialize theapples_stock
variable by using the key"Apples"
to access the stock quantity in theproducts
dictionary. - Initialize the
while
Loop: Use thewhile
keyword to initialize the loop. apples_stock
Counter: Use theapples_stock
counter variable to decrease the stock by5
units during each iteration.days
Counter: Use thedays
counter variable to increase the days by1
during each iteration.
Everything was clear?
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.
Task
- Iterate Over
products
: Use thefor
keyword to iterate over theproducts
dictionary. Use theitems()
method to access both the keyproduct
and the valuestock
. - Check Stock Levels: Within the loop, check if the stock quantity of any product is less than
20
units. - Initialize
apples_stock
Variable: Initialize theapples_stock
variable by using the key"Apples"
to access the stock quantity in theproducts
dictionary. - Initialize the
while
Loop: Use thewhile
keyword to initialize the loop. apples_stock
Counter: Use theapples_stock
counter variable to decrease the stock by5
units during each iteration.days
Counter: Use thedays
counter variable to increase the days by1
during each iteration.