#방법1 list 불러오기
list([1,2,3])
#방법2
my_str= [1,2,3]
a=[1,2,3,4,5]
b=['hello','life','today','happy']
c=['Hello',['python','hi'], (12,11,10) , 14]
인덱싱
a[4]
c[1]
c[1][0]
슬라이싱
b[0:3]
c[-2:]
리스트의 덧셈과 곱셈 ( 숫자, 문자열 )
a+b
b*2
len(리스트): 길이 구하기
len(a)
len(c)
a=[1,2,3,4,5]
리스트 삽입/수정하기
a[2]=22
a
insert(인덱스, 값)
a.insert(3, 33)
a
del 리스트[인덱스]
a= [1,2,22,4,5]
del a[3:-1]
a
append(값)
a.append([100])
aa
**sorted() - 내장함수 / .sort()- 메소드++
##(메소드(method): 어떤 자료형(객체)에 붙어 있는 함수)
aa=[1,4,5,2,3]
aa.sort()
[1,2,3,4,5]
sorted(aa)
[1,2,3,4,5]
reverse
aa.reverse()
remove(값)
aa=[5,4,3,2,1]
aa.remove(3)
pop(인덱스)
aa=[5,4,2,1]
aa.pop()
딕셔너리
key - value 형태로 정의된 자료형입니다.key : 딕셔너리의 인덱스와 같은 개념입니다. 따라서 인덱스로 불러오기는 되지 않으며 특정 key 값으로 값을 접근해야 합니다.value : 말 그대로 key와 엮여 있는 값입니다.gdp_dict = {'한국': 3000, '미국': 4000, '대만': 3500}
print(gdp_dict)
'''
{'한국': 3000, '미국': 4000,'대만':3500}
'''
temperatures = [25, 27, 24, 28, 26]
print(temperatures[-1])
product_details = {'name': '노트북', 'price': 1200000, 'brand': 'LG'}
keys = product_details.keys()
print(keys)
핵심만 깔끔하게 정리하셨네요!! 👏🏻👏🏻👏🏻 오늘두 수고하셨습니다!