# 리스트 list [] 여러 개의 값을 묶어서 저장하는 자료형 list1 = [1, 2.0, 'a', "b", [3, 4]] print(list1) #인덱스 번호는 0부터 시작한다 #인덱싱 : 원소 하나를 가져오는 것 #리스트[인덱스 번호] print(list1[1]) print(list1[3]) print(list1[-1]) #슬라이싱 : 일부를 잘라서 가져오는 것 #리스트[start시작:end종료:step칸] list2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] print(list2[0:6]) print(list2[0:6:2]) print(list2[:9:3]) #처음부터 print(list2[1::1]) #끝까지 print(list2[5:8:]) #1칸씩 print(list2[-9:-2:2]) print(list2[-2:-9:-1]) print(list2[::-1])
To embed this project on your website, copy the following code and paste it into your website's HTML: