# なんとなくSequenceというかリストというか配列あたりを今さらPythonでやってみた

```>>> a = [1]
>>> b = a
>>> c = a
>>> a.append(2)
>>> a
[1, 2]
>>> b
[1, 2]
>>> c
[1, 2]
>>> b = a[:]
>>> a.append(3)
>>> a
[1, 2, 3]
>>> b
[1, 2]
>>> c
[1, 2, 3]
>>> a.extend([4])
>>> a
[1, 2, 3, 4]
>>> a.insert(0, 0)
>>> a
[0, 1, 2, 3, 4]
>>> dir(a)
['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__delslice__', '__doc__', '__eq__', '__ge__', '__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__setslice__', '__str__', 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']
>>> a.reverse()
>>> a
[4, 3, 2, 1, 0]
>>> a.sort()
>>> a
[0, 1, 2, 3, 4]
>>> a.remove(1)
>>> a
[0, 2, 3, 4]
>>> a.pop()
4
>>> a
[0, 2, 3]
>>> a.index(2)
1
>>> a + [0]
[0, 2, 3, 0]
>>> a.count(0)
1
>>> a
[0, 2, 3]
>>> a += [0]
>>> a
[0, 2, 3, 0]
>>> a.count(0)
2
>>> d = a[1::2]
>>> d
[2, 0]
>>> a = a + b + c + d
>>> a
[0, 2, 3, 0, 1, 2, 0, 2, 3, 0, 2, 0]
>>> set(a)
set([0, 1, 2, 3])
>>> a
[0, 2, 3, 0, 1, 2, 0, 2, 3, 0, 2, 0]
>>> list(set(a))
[0, 1, 2, 3]
>>> a
[0, 2, 3, 0, 1, 2, 0, 2, 3, 0, 2, 0]
>>> a = list(set(a))
>>> a
[0, 1, 2, 3]
>>> a[::2] #only even
[0, 2]
>>>
>>> e = a[1:]
>>> e
[1, 2, 3]
>>> e[-1]
3
>>> e[-1:]
[3]
>>> e[::-1]
[3, 2, 1]
```

おしまい