Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.90 KB | None | 0 0
  1. """Instructions
  2. Add a key to inventory called 'pocket'
  3. Set the value of 'pocket' to be a list consisting of the strings 'seashell', 'strange berry', and 'lint'
  4. .sort() the items in the list stored under the 'backpack' key
  5. Then .remove('dagger') from the list of items stored under the 'backpack' key
  6. Add 50 to the number stored under the 'gold' key"""
  7.  
  8. inventory = {
  9.     'gold' : 500,
  10.     'pouch' : ['flint', 'twine', 'gemstone'], # Assigned a new list to 'pouch' key
  11.     'backpack' : ['xylophone','dagger', 'bedroll','bread loaf']
  12. }
  13.  
  14. # Adding a key 'burlap bag' and assigning a list to it
  15. inventory['burlap bag'] = ['apple', 'small ruby', 'three-toed sloth']
  16.  
  17. # Sorting the list found under the key 'pouch'
  18. inventory['pouch'].sort()
  19.  
  20. # Your code here
  21. inventory['pocket']=['seashell', 'strange berry','lint']
  22. inventory['backpack'].sort()
  23. inventory['backpack'].remove('dagger')
  24. inventory['gold']+=50
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement