1# Basics 2a, b = 1, 2 3print(a, b) 4a, b = (1, 2) 5print(a, b) 6(a, b) = 1, 2 7print(a, b) 8(a, b) = (1, 2) 9print(a, b) 10 11# Tuples/lists are optimized 12a, b = [1, 2] 13print(a, b) 14[a, b] = 100, 200 15print(a, b) 16 17# optimised 3-way swap 18a = 1 19b = 2 20c = 3 21a, b, c = b, c, a 22print(a, b, c) 23 24try: 25 a, b, c = (1, 2) 26except ValueError: 27 print("ValueError") 28try: 29 a, b, c = [1, 2, 3, 4] 30except ValueError: 31 print("ValueError") 32 33# Generic iterable object 34a, b, c = range(3) 35print(a, b, c) 36try: 37 a, b, c = range(2) 38except ValueError: 39 print("ValueError") 40try: 41 a, b, c = range(4) 42except ValueError: 43 print("ValueError") 44