Help


#1



Hi, please help!

https://www.codecademy.com/courses/python-beginner-en-pwmb1/2/5?curriculum_id=4f89dab3d788890003000096#


Oops, try again. Your code looks a bit off. Check the Hint if you need help! Your code threw the following error: 'int' object has no attribute 'append'

Traceback (most recent call last):
File "python", line 17, in
AttributeError: 'int' object has no attribute 'append'


Replace this line with your code. 

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', 'strange berry', 'lint']
inventory['backpack'].remove('dagger')
inventory['backpack'].sort()
inventory['gold'].append(50)


#2

.append() is a method for adding to lists, gold has an integer value. How can we add integers together?


#3

inventory['gold'] += 50

Thank you!


#4

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