Advertisement
FelipeNeto2

List exercise 2 (PYTHON)

Dec 10th, 2019
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. inventory = ['twin bed', 'twin bed', 'headboard', 'queen bed', 'king bed', 'dresser', 'dresser', 'table', 'table', 'nightstand', 'nightstand', 'king bed', 'king bed', 'twin bed', 'twin bed', 'sheets', 'sheets', 'pillow', 'pillow']
  2.  
  3. inventory_len = len(inventory)
  4.  
  5. first = inventory[1]
  6. last = inventory[-1]
  7.  
  8. inventory_2_6 = inventory[2:6]
  9. first_3 = inventory[: 3]
  10.  
  11. twin_beds = inventory.count('twin bed')
  12.  
  13. inventory.sort()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement