A set comprehension can transform items and keep each distinct result only once.
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.
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.