Codington
0 of 6 problems solved • 0%

Exercise prompt

Collect Region Codes

A set comprehension can transform items and keep each distinct result only once.

Example

Compare the last digits of a set of ticket numbers.

tickets = [37, 17, 40] last_digits = {ticket % 10 for ticket in tickets} print(sorted(last_digits)) # [0, 7]

Different inputs can turn into the same result. A set keeps a single 7 even though it came from two different tickets.

Your task

Use a set comprehension in region_codes(entries). Strip surrounding whitespace, uppercase each code, and skip blank entries. Return a set, including when every entry is blank.