a = [2, 4, 6, 8] a.append(10) a
[2, 4, 6, 8, 10]
a = [1, 3, 5, 7] [0] + a
[0, 1, 3, 5, 7]
a = [1, 3, 5, 7] a.pop()
7
a
[1, 3, 5]
from collections import deque
a = deque('ecruo')
a.append('s') a
deque(['e', 'c', 'r', 'u', 'o', 's'])
a.appendleft('3') a
deque(['3', 'e', 'c', 'r', 'u', 'o', 's'])
a.pop()
's'
deque(['3', 'e', 'c', 'r', 'u', 'o'])
a.popleft()
'3'
deque(['e', 'c', 'r', 'u', 'o'])
a[0]
'e'
a.rotate(2)
deque(['u', 'o', 'e', 'c', 'r'])