-- 가변객체 mutable : 할당된 값을 수정 가능 O
ex) list, set, dict
불변객체 immutable : 할당된 값 수정 X
ex) int, float, bool, str, tuple
type(5) ---> <class : 'int' >
id(x) ---> 객체의 identity 알려준다
` a = [0, 10, 20, 30, 40, 50, 60, 70 ]
b = a[:] # a 리스트 전체값
b = a[0:3] # a 리스트 인덱스 0 부터 2 (주의! 3까지가 아니라 그전까지) 까지의 값
print(b) # b = [0, 10, 20]
c = a[0:5:2] # 0부터 4사이 값/ 증가폭은 2
print(c) # c = [0, 20, 40] `
-- < string 반복문 >
<list in list : 반복문으로 돌면서 sum 구하기>
--
< break >
if에 맞는 조건 찾고서 break
< continue >
continue moves the index to the next value in the list, without executing the code in the rest of the for loop.
if 조건에 맞으면 skip 하고 다음으로 넘어감
--
all students 중에서 pop()이용해서 poetry class에 6명까지만 정원이 차면 while문 종료
<sort() / sorted() >
: list.sort() - 원본 리스트를 변화 저장
sorted(list) - 정렬된 새로운 리스트 생성