recommend_container(needs_mutation, needs_hashable) that captures the classic tuple-vs-list tradeoff. Return "list" if needs_mutation is True (lists support in-place changes; tuples don't). Otherwise, return "tuple" if needs_hashable is True (only tuples of hashable items can be dict keys or set elements). Otherwise, return "either".recommend_container(True, False)
'list'
Mutation is required, so a list wins regardless of hashability needs.
recommend_container(False, True)
'tuple'
No mutation needed, but it must be hashable — a tuple fits.
recommend_container(False, False)
'either'
Neither constraint applies, so both containers work fine.
A simple if/elif/else chain in the stated priority order solves this.