Guest User

Untitled

a guest
Dec 18th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 bit (Intel)] on win32
  2. Type "copyright", "credits" or "license()" for more information.
  3. >>> l=[1,4,6,9,4,6,2,3,0,1]
  4. >>> len(l)
  5. 10
  6. >>> l.append(7)
  7. >>> l
  8. [1, 4, 6, 9, 4, 6, 2, 3, 0, 1, 7]
  9. >>> l.sort()
  10. >>> l
  11. [0, 1, 1, 2, 3, 4, 4, 6, 6, 7, 9]
  12. >>> l.reverse()
  13. >>> l
  14. [9, 7, 6, 6, 4, 4, 3, 2, 1, 1, 0]
  15. >>> l.pop()
  16. 0
  17. >>> l.pop(6)
  18. 3
  19. >>> l
  20. [9, 7, 6, 6, 4, 4, 2, 1, 1]
  21. >>> l.append(3)
  22. >>> l
  23. [9, 7, 6, 6, 4, 4, 2, 1, 1, 3]
  24. >>> l.index(6,4)
  25. Traceback (most recent call last):
  26. File "<pyshell#13>", line 1, in <module>
  27. l.index(6,4)
  28. ValueError: 6 is not in list
  29. >>> l.index(1,4)
  30. 7
  31. >>> set(l)
  32. {1, 2, 3, 4, 6, 7, 9}
  33. >>> l
  34. [9, 7, 6, 6, 4, 4, 2, 1, 1, 3]
  35. >>>
Add Comment
Please, Sign In to add comment