""" Purpose: Show that tuples are like lists that cannot be modified Author: Luther Tychonievich (lat7h) License: Released to the public domain """ my_list = [1, 2, "three", 4.0] my_tuple = (1, 2, "three", 4.0) print('list:', my_list) print('tuple:', my_tuple) print('list[1]:', my_list[1]) print('tuple[1]:', my_tuple[1]) my_list[1] = [1, 2] my_tuple[1] = (1, 3) # cannot assign items print('modified list:', my_list) print('modified tuple:', my_tuple) my_list.append(5) my_tuple.append(5) # cannot append print('longer list:', my_list) print('longer tuple:', my_tuple) l2 = my_list + [-1, 1, 0] t2 = my_tuple + (-1, 1, 0) print('another list:', l2) print('another tuple:', t2)