mutable : 값을 바꿀 수 있음
color = ['red', 'yellow', 'blue']
color.append('green')
print(color)
>>> ['red', 'yellow', 'blue', 'green']
+
color = ['red', 'yellow', 'blue']
color = color + ['green', 'black']
print(color)
>>> ['red', 'yellow', 'blue', 'green', 'black']
color = ['red', 'yellow', 'blue']
color.insert(1, 'green')
print(color)
>>> ['red', 'green', 'yellow', 'blue']
'coding'[1:4] # 'odi' 인덱스 1부터 4 전까지 자름
my_arr = ['a','b','c','d','e']
my_arr[0:3] # ['a','b','c']
my_arr[2:] # ['c','d','e']
my_arr[:4] # ['a','b','c','d']
my_arr[:] # ['a','b','c','d','e']
my_arr = ['a','b','c','d','e']
my_arr[0:5:2] // ['a','c','e']
my_arr = ['a','b','c','d','e']
del my_arr[2]
my_arr # ['a','b','d','e']
my_arr = ['a','b','c','d','e']
my_arr.remove("b")
my_arr # ['a','c','d','e']
my_arr = ['a','c','b','e','d']
my_arr.sort()
my_arr # ['a','b','c','d','e']
my_list = ['a','c','b','e','d']
you_list = sorted(my_list)
print(my_list) # ['a', 'c', 'b', 'e', 'd']
print(you_list) # ['a', 'b', 'c', 'd', 'e']
student_tuples = [ ('John', 18, '4'), ('Jane', 12, '4.5'), ('Dave', 10, '3.8') ]
sorted(student_tuples, key=lambda student: student[2]) # sort by student[2] 학점
# [('Dave', 10, '3.8'), ('John', 18, '4'), ('Jane', 12, '4.5')]