dedupe_sorted_tuple(items) that takes an iterable of ints and produces an immutable, deduplicated, ascending-order tuple by explicitly converting between all three container types: first to a set (drops duplicates), then to a list (so it can be sorted in place), then finally back to a tuple to return.dedupe_sorted_tuple([3, 1, 2, 3, 1])
(1, 2, 3)
Duplicates removed via set, then sorted, then returned as a tuple.
dedupe_sorted_tuple((5, 5, 5))
(5,)
A single-element result is still a 1-tuple.
set(items) removes duplicates but loses order.
list(a_set) makes it sortable with .sort().
tuple(a_sorted_list) produces the final immutable result.