문제
아래와 같은 리스트를 만들고, 그 리스트의 다양한 부분 리스트를 출력하는 프로그램을 작성하라.
['Carrot', 'Onion', 'Cabbage', 'Potato', 'Sweet Potato', 'Bean']
예제1
출력
첫 번째 원소: Carrot
마지막 원소: Bean
리스트 거꾸로 출력하기: ['Bean', 'Sweet Potato', 'Potato', 'Cabbage', 'Onion', 'Carrot']
li[2:5]: ['Cabbage', 'Potato', 'Sweet Potato']
li[5:2:-1]: ['Bean', 'Sweet Potato', 'Potato']
li[1:6:2]: ['Onion', 'Potato', 'Bean']
출처
자기주도 파이썬