1# basic tuple functionality 2x = (1, 2, 3 * 4) 3print(x) 4try: 5 x[0] = 4 6except TypeError: 7 print("TypeError") 8print(x) 9try: 10 x.append(5) 11except AttributeError: 12 print("AttributeError") 13 14print(x + (10, 100, 10000)) 15 16# inplace add operator 17x += (10, 11, 12) 18print(x) 19 20# construction of tuple from large iterator (tests implementation detail of uPy) 21print(tuple(range(20))) 22 23# unsupported unary operation 24try: 25 +() 26except TypeError: 27 print('TypeError') 28 29# unsupported type on RHS of add 30try: 31 () + None 32except TypeError: 33 print('TypeError') 34