It's Dangerous to go alone!, Take This!


#1



I believe my code is technically correct except I still can't pass it through.


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


All the values are correct in the end when I printed them out yet I get this error message saying I haven't.


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"]
backpack.sort()
inventory["gold"] += 50
print inventory["pocket"]


#2

# Your code here
#You should write this

inventory['pocket']=['seashell','strange berry','lint']
inventory['backpack'].sort()
inventory['backpack'].remove('dagger')
inventory['gold']+=50


#3

After looking at some previous responses it shows there's a space between "strange" and "berry". It's not at all noticeable in the Codeacademy instructions so there was confusion there. I think there should be a change so that the spacing is more noticeable since in the instructions it just appears as if the writer ran out of space and decided to start berry in a new line but still as a continuation of strange.


#4

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

inventory ['backpack'].sort()
inventory ['backpack'].remove("dagger")

inventory ['gold'] = 500 + 50
print inventory['gold']

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


#5

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