record = (name, tags) where tags is a list, implement add_tag(record, new_tag) that appends new_tag to the tags list in place (mutating the list nested inside the tuple is fine, since the list itself is mutable) and returns the same tuple object. Then implement replace_name(record, new_name), which cannot assign into the tuple's first slot directly, so it must return a brand-new tuple with the name replaced while reusing the same tags list object.add_tag(('Server1', ['prod']), 'critical')('Server1', ['prod', 'critical'])The inner list was mutated; the outer tuple object is unchanged.
replace_name(('Server1', ['prod', 'critical']), 'Server2')('Server2', ['prod', 'critical'])A new tuple is built since record[0] = new_name would raise TypeError.
add_tag: unpack record into name, tags, then tags.append(new_tag), then return record unchanged.
replace_name: unpack record to grab tags, then return a fresh tuple (new_name, tags).