Challenge 3 Megathread

For any and all questions relating to challenge 3. :point_down:

For a tutorial on how to use Jupyter Notebook, we put together this video:

Still have questions? Read all the FAQs here.

1 Like

Holy Moly Batman.
This problem is 95% red herring, and 3% a lie.

It says in bold " Use python’s pop(), insert(), and append() list functions to change the shopping_list above so that it reflects the right materials needed."

Then " Create a paint_list list from the new_shopping_list list using the built in python list indexing ability."

That first part is a complete lie. why? Are we supposed to learn about ignoring useless and contradictory information? The only reason you can tell what the answer should be is because it’s multiple choice.


Can someone explain how you’re supposed to reason through that problem statement and actually arrive at the answer they’re looking for? Based on their description of where the paints are in the list and common sense for good list slicing, there’s only two reasonable answers. But I have no idea how I’m supposed to know the number of paints/woods they want… or at least I thought I knew in my initial guess, but apparently not.


Humm! that will be nice to understand the challenge! Am I the first getting confused? Now I understand the concept of lists, dictionaries and the methods to be used, but I do not get the challange


As ConKun mentioned there is a lot of unnecessary info in the description. The actual challenge is only a small piece, which is the shopping list and reading the answers which imply that you’re making a paint list from a subset of the shopping list. The hint was helpful too.


When you apply the “unnecessary” information with bigger dataset, those information will be helpful. I think although the problem is provided with many information that doesn’t need for completion of the challenge, it helps you more comfortable with reading requirement, choose important information to follow and get correct answer.

1 Like

This is a puzzle for sure, but required 1% list manipulation vs understanding the question. For those in the industry, it’s good practice for working with poor business analysts/product people lol .

Hope the upcoming exercises actually requires using python as part of the challenge

hint: you need to replace the ‘damaged’ wood… wasn’t obvious to me


Here are some of the ways that I’ve interpreted this question:

  1. We can set new_shopping_list using the dictionary provided (or at least by reading elements off the dictionary), and then set a slice of that list as paint_list.
  2. We can directly set paint_list as a slice of shopping_list provided.
    There are many more potential solutions.

For anyone who was as confused as me, you need to replace all of the damaged wood, and paint over those same rooms.


It also says they want to paint all the rooms blue. So I guess the idea is that the wood and paint sections of the list are asymmetric in the end. From my initial read of the problem I thought it was implied that there was always a 1:1 relationship of wood to paint.


Why did it matter that Dot doesn’t like Oak and prefers Maple…?


just get the slice of the paint part… [3:] from the zero based index in python who writes these challenges? I failed my first attempt.
1- Create a new list from the original shopping
2- Pop the white paints (Except the kitchen one)
3- Append Blue paint for all remaining rooms
4- Replace Oak with Maple (pop and insert at given index) and leave the Cherry Planks alone
5- At the end just get the slice of the paint part of the new shopping list [3:]


I am new to coding. I thought that this challenge would be great for me to get a bit of practice everyday and learn new things. However, I noticed that in the brief tutorial they made a mistake.

They provide a list of integers
list_of_int = [1,2,3,4,5] # list of integers
And then give this example for indexing or slicing
list_of_int[0:2] # will print out [1,2,3]

I could not get the code to run properly with the indexing example provided. I didnt understand what I was doing wrong. After looking at the hint provided, I realized that there was a contradictions in the tutorial and in the hint. This was very confusing and I had to do online research instead. As a beginner, these mistakes are very frustrating.


The dictionary here (blueprint) is actually contextual information, than something that needs to be used directly in solving the problem.

From my understanding, blueprint describes:

  • what rooms have Oak (and hence needs Maple instead) and what rooms do not have Oak (do not need any replacement of wood, if they aren’t damaged either). This helps adhere to Dot’s condition (1).
  • it also gives an idea of the pre-existing colors for each of the rooms. So, if the pre-existing color does no match Dot’s desired color for that room, as per Dot’s condition (2), then it must be painted accordingly.

Hence, new_shopping_list is derived from shopping_list using pop(), insert() and append() to edit the list, and paint_list from new_shopping_list as a slice of it.

Of course, in this smaller data set, it might be as simple as listing our the values manually, in order to get the solution. However, that may not be practical in larger datasets.

Hope this helps!


I love Lighthouse Labs, and they did a wonderful job of teaching me good practices and gave me a better understanding of programming in general, but I have to say, these first three challenges have been terrible. This is definitely not a data (or even coding) challenge and is in fact a riddle solving challenge.

I’m not sure why these questions are posed as riddles, but it certainly isn’t helping anyone.


I Re-read the solution and your explanation and now it makes more sense on why the shopping list had the items that it had at the first place, damaged planks and paint for those. Then it made sense why Dot wanted to replace the oak ones and just leave the kitchen white and the rest blue. Then comes the manipulation, pop,append, insert and at the very end youre just asked to return the list of paints using the slicing

1 Like

I spent a chunk of time trying to code a solution that seemed to respond to fit the provided answers.
Understanding exactly what they are looking for as an answer is the real challenge here – and second guessing the requirements introduces too much confusion. As well, in this case, updating the existing list is more work than just generating a new list. I don’t know if the intent was to include and query the dictionary, but that provided a slightly more general solution.


For those of you that are struggling a bit, the question is not a friendly one if you are just starting to learn how to code. It requires some thinking outside of the code, as it were, as it’s not just about manipulating lists but about:

  • Figuring out what information is fluff and what is essential
  • Then isolating the information you need and discarding what you don’t need
  • Stepping through the logic and the constraints that are applied (in Dot’s preferences)
  • Navigating tricks and what I will essentially call ‘bait’ (this problem is really more like a riddle than a real test of coding, as you will see in the solution I provide below)

Additionally, it may not initially be clear that you need to create new intermediary variables and what those may be. Anyhow, I’ll try to break it down if it helps people see the logic and I can see how it isn’t clear in this scenario. Let’s walk through it.

Note: I’m not really manipulating the data/code with Python. I’m merely discussing the logic, stepping away from the code for a second, as presumably you might manage to tackle the specific coding tasks required to fulfill all the steps, once you realize what exactly is being asked and the logic of what needs to be done.

We know Dot has essentially 6 rooms in her home:

  1. Kitchen
  2. Dining Room
  3. Living Room
  4. Bedroom
  5. Bathroom
  6. Shed

Dot needs to go buy wood and paint. She also has two conditions:
First Constraint: She hates Oak (and prefers Maple but this is irrelevant, as we’ll see shortly)
Second Constraint: She wants a specific colour of paint in each room (blue everywhere except for the white in the kitchen).

We can see she has an old blueprint of what is currently in her home:

old_blueprint = {
    "Kitchen": ['Dirty', 'Oak', "Damaged", "Green"],
    "Dining Room": ['Dirty', 'Pine', 'Good Condition', 'Grey'],
    "Living Room": ['Dirty', 'Oak', 'Damaged', 'Red'],
    "Bedroom" : ["Clean", 'Mahogany', 'Good Condition', 'Green'],
    "Bathroom": ["Dirty", 'White Tile', 'Good Condition','White'],
    "Shed"    : ['Dirty', "Cherry", "Damaged", "Un-painted"]

We’re given an example shopping list, in which we are told to list the woods we need (one after the other) and then listing the paints we need. If I were to type up the list in full, it would look like this:

new_shopping_list = ['Kitchen Wood Type', 'Dining Room Wood Type', 'Living Room Wood Type', 'Bedroom Wood Type', 'Bathroom Wood Type', 'Shed Wood Type', 'Kitchen Paint Type', 'Dining Room Paint Type', 'Living Room Paint Type', 'Bedroom Paint Type', 'Bathroom Paint Type', 'Shed Paint Type']

Notice I keep things general, as well? The wood and paint types don’t actually matter just yet. This shopping list is the full list, if we were replacing all the wood and all the paint: I’ve listed them out in the same order as the blueprint and in the order of wood types first then paint types, as required by the note given to us.

Now, however, we can see that the original blueprint (old_blueprint above) as some Oak inside, which should be replaced per Dot’s First Constraint (i.e. Dot needs to buy wood to replace it and so we keep the room that is affected on the shopping list) but there is also other stuff, like Pine and Mahogany, which Dot doesn’t care about either way (so we can remove these from the shopping list because they aren’t going to be replaced as it doesn’t matter to Dot).

Thus our new_shopping_list shrinks because we can see that the Dining Room, the Bedroom, and the Bathroom have acceptable floors that satisfy Dot’s First Constraint(i.e. not Oak wood). The Kitchen and Living Room have Oak wood, which Dot hates and will want to replace, hence they stay on the shopping list.

Here’s a trick they now throw at you: notice that the Shed has the ‘Damaged’ condition? Thus, despite the wood type being acceptable to Dot, it still needs to be replaced. So we keep it in the shopping list because she needs to buy more of it.

Our updated shopping list is as follows now (shrunk from 12 elements in our list to now 9).

new_shopping_list = ['Kitchen Wood Type', 'Living Room Wood Type', 'Shed Wood Type', 'Kitchen Paint Type', 'Dining Room Paint Type', 'Living Room Paint Type', 'Bedroom Paint Type', 'Bathroom Paint Type', 'Shed Paint Type']

Now, the paint. All the rooms need to be blue, except the kitchen which needs to be white, as per Dot’s Second Constraint. Let’s look through the list in the old_blueprint and see, one by one, which rooms satisfy this condition.

Well, there is no blue at all in the list, and the kitchen is not white in the Old Blueprint list but green, so nothing is satisfied here: Dot needs to buy paint to paint every room (i.e. all 6 rooms).

So our new_shopping_list doesn’t change here, because we need to replace the paint in each room (and so Dot needs it on the list in order to go buy it next time she goes to compare city and country prices in a strange way).

Now, however, the final part of the question is this: “Create a paint_list list from the new_shopping_list”. Basically, using the new_shopping_list variable we just made above, create a new list that is a subset of the shopping list where we just list the paint we need. How do we do this? Well, we can take the new_shopping_list and slice it up using Python indexing to our advantage: in new_shopping_list, check to see at which element the list of paints start…it’s the 4th one in the list, right? Now, remember Python starts indexing with 0, so if we start counting at 0 instead of 1, we see it’s actually the 3rd one in the list. Thus:

paint_list = new_shopping_list[3:]

and printing the list yields

['Kitchen Paint Type', 'Dining Room Paint Type', 'Living Room Paint Type', 'Bedroom Paint Type', 'Bathroom Paint Type', 'Shed Paint Type']

We’re taking the new shopping list we made, and we’re saving everything from the third index to the end of the list as a new variable, which will be called paint_list and ultimately has all the paint Dot needs to buy.

It’s very late where I am right now, so I apologize if this may not be 100% clear, perhaps I’m not completely coherent. Let me know, I’m happy to respond if I can, as I’m seeing a lot of frustration that could have been generally circumvented, I think, and I’m happy to help.

Notice that for this smaller question, we kept things general to see how the logic works. I never actually specify wood or paint types in the pseudocode above, and I type out certain things in full in order to make sure it is clear to the reader how I approach and come to certain conclusions. However, in a larger dataset, I would never actually type it all out like this and I would want to be mindful of how I run checks to clean up the old_blueprint (say the old_blueprint wasn’t 6 rooms but 600, instead). However, the specifics of accomplishing this are perhaps a topic for another time. Additionally, I’m sure there may be other ways of solving the problem but I wanted to share this step-by-step to get to the solution and I hope this clears things up a bit.


Your explanation was fantastic! Many thanks!!! Now I understand what they’re asking.

Hey, as confused as I am with this challenge - it is equally bizarre that the “Submit Answer” button does not work for me! Would anybody know why or has faced something similar?

1 Like