Reporting a Bug in 14. It's Dangerous to Go Alone! Take This


#1



It's Dangerous to Go Alone! Take This


Oops, try again. It looks like you do not have all the correct items in inventory["pocket"].


I expect for the exercise to be complete but it's saying that I'm missing items in the list which I am not.


inventory = {
    'gold' : 500,
    'pouch' : ['flint', 'twine', 'gemstone'], # Assigned a new list to 'pouch' key
    'backpack' : ['xylophone','dagger', 'bedroll','bread loaf']
}

# Adding a key 'burlap bag' and assigning a list to it
inventory['burlap bag'] = ['apple', 'small ruby', 'three-toed sloth']

# Sorting the list found under the key 'pouch'
inventory['pouch'].sort() 

# Your code here
inventory["pocket"] = ['seashell', 'strangeberry', 'lint']
inventory['backpack'].sort()
inventory['backpack'].remove('dagger')
inventory['gold'] += 50


#2

Hi, @ramo796 ,

The second instruction says ...

Set the value of 'pocket' to be a list consisting of the strings 'seashell', 'strange berry', and 'lint'

The 'strangeberry' in the following statement, without the space, will not suffice ...

inventory["pocket"] = ['seashell', 'strangeberry', 'lint']

#3

but even with my code which has a space between strange and berry, does not work.`

inventory = {
    'gold' : 550,
    'pouch' : ['flint', 'twine', 'gemstone'], # Assigned a new list to 'pouch' key
    'backpack' : ['xylophone','dagger', 'bedroll','bread loaf']
    'pocket' : ['seashell', 'strange berry', 'lint'] }
    
# Adding a key 'burlap bag' and assigning a list to it
inventory['burlap bag'] = ['apple', 'small ruby', 'three-toed sloth']
inventory['backpack']"dagger"()
# Sorting the list found under the key 'pouch'
inventory['pouch'].sort() 
inventory['backpack'].sort()
# Your code here

`


#4

Hi @nirmals7 ,

Your code has some invalid syntax.

Within a dictionary, every key-value pair must be separated from the next one by a comma. Check the code for the dictionary that gets assigned to the variable, inventory.

This syntax is invalid ...

inventory['backpack']"dagger"()

The above needs to be revised in order to remove "dagger" from the inventory['backpack'] list. It should use the list.remove(x) method to perform that removal.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.