Distinct Email Domains

Easy ⏱ 8 min 88% acceptance ★★★★★ 4.6
Write domains(emails) returning the set of lowercase domains (the part after @) found in a list of email addresses, via a set comprehension.

Examples

Example 1
Input
domains(['a@Gmail.com', 'b@yahoo.in', 'c@GMAIL.com'])
Output
{'gmail.com', 'yahoo.in'}
Explanation

The two Gmail variants collapse after lowercasing.

Constraints

  • Use a set comprehension with {}.
  • Lowercase the domains.

Topics

List Comprehensionsset comprehension

Companies

SalesforceOracle

Hints

Hint 1

email.split('@')[1] isolates the domain.

Hint 2

Braces instead of brackets make it a set comprehension.

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.