#pop - n번째 원소 제거
fruits = ['딸기', '포도', '사과', '체리']
#fruits.remove('포도')
fruits.pop(1)
fruits.pop() #맨 마지막을 삭제
print(fruits)

#count - 특정 자료의 개수 조회
nums = [2, 2, 2, 3, 3, 4, 5]
print(nums.count(2))

#split - 문자열을 쪼개서 리스트로 변환
str = "ialikeapython"
print(str.split('a')) #a를 기준으로 나눔
str2 = '1 2 3 4 5'
print(str2.split(' ')) #공백을 기준으로 나눔

#join - 리스트를 합쳐서 문자열로 변환
dessert = ['두쫀쿠', '탕후루']
print('&'.join(dessert))

#튜플 - 자료형
() #빈 튜플
(1,) #원소가 하나일 때 무조건 쉼표도 같이
my_tuple = (1, 2, 3, 4, 5)
print(my_tuple[1:3]) #슬라이싱
print(1 in my_tuple) #원소조회
print(len(my_tuple)) #길이확인

#딕셔너리 - 자료형
#{key : value , key2 : value2}
my_dict = {} #빈 딕셔너리
person = {'name': '김알고', 'age': '10'}
#딕셔너리의 자료 꺼내기
print(person['name'])
#딕셔너리의 자료 추가하기
person['birth'] = '0131'
print(person)
#딕셔너리의 자료 삭제하기
del person['age']
print(person)
#딕셔너리의 key는 바뀔 수 없다


















Embed on website

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