이중리스트
-
Python Chapter09방뚝딱 학습노트 2023. 10. 29. 19:30
교재 : 멘토씨리즈 파이썬 이중리스트 list의 원소 타입은 어떠한 자료형도 가능합니다. list가 list의 원소가 될 수 있습니다. 이러한 list를 이중, 삼중…n중 리스트라고 표현합니다. 이중리스트는 2차원 문제를 해결할 때 주로 사용합니다. 이중 리스트는 두개의 인덱싱을 활용해 하나의 개별 원소에 접근합니다. ex) -리스트명 [][] : 개별 원소에 접근 -리스트명 [] : 1차원 리스트에 접근 실습) 예제1) 튜플 순서가 있다, 중복을 허용한다. animals=(’dog’,’cat’,’bird’,’fish’,’tiger’) 튜플은 ()가 없어도 튜플이고 튜플의 본질은 ,에 있습니다. 원소가 하나인 튜플을 만드려면 원소 뒤에 ,를 붙히면 됩니다. animal2 = ‘dog’, 예제) 튜플연산 ..