Collect All Cookies (Exercise)
00:00 As everybody knows, there is no party without cookies. So look on the shelf and under the sofa to collect all the cookies. To avoid crumbling any precious cookies, you are not allowed to throw them. That’s wise.
00:14
Instead, you need to carefully hand over every cookie list with a return
statement.
00:22 Update the program below that the output looks like this, and there is a list with the strings, “Peanut”, “Chocolate”, “Oat”, and “Salted Caramel”. And then there is a code snippet that again you can find in the supporting materials.
00:36
And the code snippet has two functions, one named on_the_shelf()
and one named under_the_sofa()
. And then a cookies
variable, which currently is an empty list and a print()
function call, which has cookies
as the argument.
00:52
And yeah, currently the cookies
list would be empty so your task is to adjust the on_the_shelf()
and under_the_sofa()
functions to actually return the cookies.
Become a Member to join the conversation.