#튜플tuple () : 여러 개의 값을 하나로 묶을 수 있는 자료형
#한 번 만들면 절대 바꿀 수 없다!!

color = ('red', 'yellow', 'green', 'blue')
#1. 인덱싱, 슬라이싱을 할 수 있다
print(color[2])
print(color[1:3])

#2. 원소를 조회하고, 길이를 확인 할 수 있다
print('orange' in color)
print(len(color))

#3. 더하기+ 곱하기* 연산을 할 수 있다
print(color + (3, 7, 21))
print((3,) * 5) #튜플은 원소가 하나여도 쉼표 필수!!

#4. 원소의 수정,추가,삭제가 불가능하다
#color[0] = 'orange'
#color.append('pink')
#g6color.remove('red')

print('----문제----')
재료 = ('개구리 혀', '용의 눈물', '반딧불 이슬', '고양이 수염')
print(재료[1])
print(len(재료))
print('불꽃' in 재료)

pages = [(1, 2), (3, 4), (5, 6)]
print(pages[2])
print(pages[2][0]) #2번 인덱스인 튜플의 0번 인덱스인 원소














Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: