#리스트에 관한 메서드
#append 리스트의 가장 마지막에 더해주는 것
a = []
a.append(10)
a.append('a')
print(a)

#insert 리스트의 특정 위치에 추가하는 것
b = [5, 7, 1, 9, 3]
b.insert(1, 6)
b.insert(3, 'a')
print(b)

#remove 특정 원소를 삭제하는 것
b.remove(1)
print(b)

line_up = ['거북이', '토끼', '코알라', '도도새']
line_up.remove('토끼')
print(line_up)

#sort 정렬하기
c = ['banana', 'cake', 'apple']
c.sort()
print(c)

#원소의 순서
d = "once"
print(d[1])
print(d[1:3])
print(d[-1])
print(d[:2])
print(d[:])

#시퀀스
#원소 조회하기
e = ['토끼', '거북이', '사자', '강아지']
print('강아지' in e)

#길이 확인
print(len(e))

#연결 연산
c = ['t', 'w', 'i'] + ['c', 'e']
print(c)

#반복 연산
d = ['hi' * 3]
print(d)

fruits = ['바나나', '딸기', '두리안', '망고']
if '딸기' in fruits:
    fruits.remove('딸기')
    print(fruits)
else:
    print("딸기가 없습니다.")

Embed on website

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