Python Lists and Dictionaries


What's wrong with my code ?
Please help !


The error says, "Unexpected indent", which is your problem. Un-indent the last four lines.


There should be no indent on lines 14-17. I think you still have to be more specific and add 'pocket' to inventory. For example
inventory['pocket']= ..........
look at line 8 of your code. Thats basically the answer for step 1


Can you get me the correct program @cadecodes @jasoncheung94


Nope. Asking for correct code is against community guidelines.


Bruh !! Fine.. Then help me somehow.. I've been stuck in this problem for a month !

Even this gives me a error !


It is right, backpack isn't defined. It is a key (HINT) in the inventory dictionary. :slightly_smiling:


How do I define it ?


The point of not giving out solutions is that if you can't produce them yourself then there's something important that you need to learn. If you don't want to learn that thing whatever it is, then you've got no business asking for help either.

Your next error says that backpack isn't defined - so either you missed defining it or you should be accessing something else.


You're skipping a step. Should it be defined at all? Take some time to read and understand the code and the instructions.

How is the backpack represented in the code? And how can you manipulate that?


What is still wrong ?


Now you are re-assigning inventory. Think about what the problem is. It certainly isn't the inventory.


I'm still not able to get it !!


THINK about what the error is saying...


Do you see the variable backpack defined anywhere?
What does it look like when a variable is created?
If there's no variable called backpack, then trying to use it is pointless. So, how is the backpack represented in the code?


Did it..
Thanks @cadecodes @ionatan !!


Just make sure that you you've verified yourself that what you did had the desired effect.
Randomly trying things is just as likely to break the submission test and make it pass you that way.
(Excuse my scepticism, you did go very quickly from no clue to getting that badge)

If you convinced yourself that you got it right, then you did, but if you suddenly got passed for no better reason than before, then you probably just broke it.