SHARE
TWEET

Untitled

a guest Nov 14th, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. lists are very powerful, the elements can be everything you want, including another list
  2.  
  3. Other operations of list:
  4. 1. Append
  5.   like a procedure, but its a method.
  6.   will add a new element to the end of list
  7.   not creating a new list, but mutating the old list
  8.  
  9. <list>.append(<element>)
  10. [1,2].append([3,4]) → [1,2,[3,4]]
  11.  
  12. 2. Plus
  13.   <list> + <list>
  14.   [0,1] + [2,3] = [0,1,2,3]
  15. #be careful about the deffernce between append and plus  
  16. 3. len
  17.   len(<list>)
  18.   len also works for strings
  19.   len(['a',['b',['c']]]) → 2
RAW Paste Data
Top