All problems
Strip Accents (NFC-lite)
Problem
Return text with diacritical marks removed. Normalize with Unicode NFD so base characters and combining marks are separate, then drop every combining character.
Characters without accents are left unchanged.
Hint
unicodedata.combining returns non-zero for combining marks.
Test cases
case 1
in: ["café"]
expected: "cafe"
case 2
in: ["naïve"]
expected: "naive"
case 3
in: ["Añejo"]
expected: "Anejo"
case 4
in: ["abc"]
expected: "abc"
case 5
in: [""]
expected: ""
Starter codePython
import unicodedata
def strip_accents(text):
# Your code here
pass5 test cases · run your code against them in the editor