Not sure in what way you think it's misbehaving, you have to explain that so that we know what to look for, but on your second last line, you try to use
"backpack"["dagger"] as a key, and those are two separate values, a string and a list containing a string and you can't just put two values next to each other without saying how they relate to each other!
Actually I got that wrong, although that part is still incorrect.
"backpack"["dagger"] is not two separate values, that is trying to use a string as an indexer to another string. That's not valid, only integers can be used that way, for example:
Now I have no idea what the exercise asks you to do, but here's how you can do a few things:
inventory["backpack"] is a list, right? And if you want to remove "dagger" from that list then you can call the remove function on that list, like so:
or if you want to remove at a certain index of that list
but if it's
"dagger" you want to remove, then you won't know what index it is until you've looked at the list, which is why you would use the
remove method instead in that case.