List, Set, Range
✔️ *
N = [1, 2, 3, 4, 5]
print(*N)
>> 1 2 3 4 5
N = [[1, 2, 3], [4, 5, 6]]
print(*N)
>> [1, 2, 3] [4, 5, 6]
✔️ 변수 할당
x, y, z = [1, 2, 3]
>> x = 1 , y = 2 , z = 3
x, y, z = [1, 2, 3, 4, 5] # 할당할 변수 부족으로 에러 발생
>> ValueError: too many values to unpack (expected 3)
x, y = [[1, 2, 3], [4, 5, 6]]
>> x = [1, 2, 3]
>> y = [4, 5, 6]
✔️ *
N = set([1, 2, 3, 4, 5])
print(*N)
>> 1 2 3 4 5
✔️ 변수 할당
a, b, c, d, e = set([1, 2, 3, 4, 5])
print(a, b, c, d, e)
>> 1 2 3 4 5
✔️ *
N = range(5)
print(*N)
>> 0 1 2 3 4
N = range(2, 10, 2)
print(*N)
>> 2 4 6 8
✔️ 변수 할당
a, b, c, d, e = range(5)
print(a, b, c, d, e)
>> 0 1 2 3 4
a, b, c, d = range(2, 10, 2)
print(a, b, c, d)
>> 2 4 6 8
a, b, c, d, e = range(2, 10, 2)
print(a, b, c, d, e)
>> ValueError: not enough values to unpack (expected 5, got 4)