select_option(raw, options) that simulates handling a user's typed menu choice. raw is the string typed by the user (as if returned from input()), and options is a list of valid string choices. If raw.strip() (case-insensitively) matches one of options, return the matching option in its original casing from options. Otherwise return "Invalid option".select_option(" Yes ", ["Yes", "No"])'Yes'
Trimmed input matches "Yes" case-sensitively after stripping.
select_option("no", ["Yes", "No"])'No'
Case-insensitive match returns the canonical casing "No".
select_option("maybe", ["Yes", "No"])'Invalid option'
Not one of the allowed options.
Strip raw first, then compare with .lower() against each option's .lower().
Return the item from options (not raw) so casing stays canonical.