Who can help me?


#1



# Your code here
inventory['pocket'] = ['seashell', 'strange berry', 'lint']
inventory['backpack'].sort() 
inventory['backpack'].remove('dagger') 
inventory['gold'].append(50)

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


#2

this line:

inventory['gold'].append(50)

look:

print inventory['gold']

gold is a integer (int) object, .append() is a attribute for lists. To add integers together, simply use +


#3

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