The Immutable Exhibition: Why Tuples Never Change
%20(1).jpeg)
The Immutable Exhibition: Why Tuples Never Change Timothy had mastered lists for organizing books, but one afternoon Margaret led him to a restricted section of the library: The Locked Display Cases. Here, collections were sealed behind glass—visible but permanently unchangeable. The Permanent Collections "These are tuples," Margaret explained, gesturing to the display cases. "They look similar to lists but with one crucial difference: once created, they can never be modified." Timothy examined a case containing coordinate pairs for mapping the library: main_entrance = ( 42 , 15 ) # x, y coordinates rare_books_section = ( 108 , 73 ) # Can read the values x_position = main_entrance [ 0 ] # 42 y_position = main_entrance [ 1 ] # 15 # Cannot modify them main_entrance [ 0 ] = 50 # TypeError: tuple doesn't support item assignment The parentheses instead of square brackets signaled this permanent nature. Once the coordinates were set, they rema...