tuple
Assignment는 tuple안의 값을 업데이트 하는 것 x = (2, 8, 3, 6) # tuple은 소괄호, list는 대괄호 x[3] = 10 print(x) # 결과값: # error 뜸 Traceback (most recent call last): File "main.py", line 4, in x[3] = 10 TypeError: 'tuple' object does not support item assignment Tip: list는 안에 있는 element를 변경할수 있지만, tuple은 변겨 할 수 없음 즉 list = mutable(가변), tuple = immutable(불변)
2019.08.19