Deduplicate Sign-ups by Normalised Email

easy
Checkpoint challenge
Solve this to show you know the material and jump straight to Unit 2. Everything before it counts as cleared.

People sign up twice as Ada.Lovelace+news@Gmail.com and adalovelace@gmail.com. Normalise emails to catch duplicates:

  • Trim whitespace and lowercase everything.
  • For gmail.com and googlemail.com: remove dots from the local part, drop everything from + onwards, and use the domain gmail.com.
  • For all other domains: only drop a +tag from the local part.
  • Invalid addresses (not exactly one @, or an empty local part or domain) raise ValueError.

Implement normalize_email(email), then find_duplicate_signups(emails), which returns groups (lists of the original strings, in input order) that normalise to the same address, for groups with 2 or more members. Order the groups by first appearance and skip invalid emails.

#strings#dedup#data-cleaning2 visible + 2 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Deduplicate Sign-ups by Normalised Email · TechGradify