#점 표기법 : 점.을 이용해서 리스트나 문자열에 연결된 함수를 사용하는 것

#append() 리스트 맨 뒤에 추가
#리스트.append(추가할 원소)
a = [1, 2, 3]
a.append(4)
print(a)

#insert() 원하는 곳에 추가
#리스트.insert(추가할 위치, 추가할 원소)
b = [1, 2, 4, 5]
b.insert(2, 'a')
print(b)

#remove() 원하는 값을 삭제
#리스트.remove(삭제할 원소)
c = [3, 1, 2, 3, 4]
c.remove(3)
print(c)

#sort() 순서대로 정리: 가나다,abc,123
#리스트.sort()
d = [7, 2, 4 ,6, 1, 3, 2, 9, 5]
d.sort()
print(d)

print('----문제----')
line = []
line.append('토끼')
line.append('거북이')
line.append('홍학')
print(line)

line.insert(1, '도도새')
print(line)

line.remove('도도새')
print(line)

line.sort()
print(line)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: