Letters Unique to the First Word

Easy ⏱ 8 min 74% acceptance ★★★★★ 4.6
Write exclusive_letters(word_a, word_b) returning a sorted list of the distinct letters that appear in word_a but not in word_b. Comparison is case-insensitive; output lowercase.

Examples

Example 1
Input
exclusive_letters('Machine', 'chain')
Output
['e', 'm']
Explanation

m and e are in 'machine' but not 'chain'.

Constraints

  • Case-insensitive.
  • Sorted lowercase output.

Topics

Setsdifference

Companies

AdobeCognizant

Hints

Hint 1

Strings are iterables of characters — sets accept them directly.

Hint 2

Use set difference then sorted().

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