Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lists are very powerful, the elements can be everything you want, including another list
- Other operations of list:
- 1. Append
- like a procedure, but its a method.
- will add a new element to the end of list
- not creating a new list, but mutating the old list
- <list>.append(<element>)
- [1,2].append([3,4]) → [1,2,[3,4]]
- 2. Plus
- <list> + <list>
- [0,1] + [2,3] = [0,1,2,3]
- #be careful about the deffernce between append and plus
- 3. len
- len(<list>)
- len also works for strings
- len(['a',['b',['c']]]) → 2
Add Comment
Please, Sign In to add comment