Code RoomUnicode normalization allows duplicates
HardPrep Room Coding #1971

Unicode normalization allows duplicates

Code reviewCode quality & reviewSenior–Staff~20 min

Review this Python that enforces unique display names by lowercasing and checking against the set of claimed keys.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 20 min
Mark a line and say what kind of problem it is.0 findings
1def make_key(name):
2 return name.strip().lower()
3 
4def claim_name(name, taken):
5 key = make_key(name)
6 if key in taken:
7 raise ValueError('name taken')
8 taken.add(key)
9 return key
10 
11# u1 = claim_name('caf\u00e9', taken) # NFC: U+00E9
12# u2 = claim_name('cafe\u0301', taken) # NFD: e + U+0301
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.