All problems
Simple Plural Normalization
Problem
Normalize a plural English word to a naive singular form. Rules are checked in order: words ending in 'ies' with length > 3 become 'y'; words ending in 'ches' or 'shes' with length > 4 drop the 'es'; words ending in 'es' whose third-from-last character is 's', 'x', or 'z' drop the 'es'; words ending in 's' but not 'ss' with length > 1 drop the 's'.
Otherwise return the word unchanged.
Hint
word[-3] reads the third character from the end.
Test cases
case 1
in: ["stories"]
expected: "story"
case 2
in: ["boxes"]
expected: "box"
case 3
in: ["churches"]
expected: "church"
case 4
in: ["cats"]
expected: "cat"
case 5
in: ["glass"]
expected: "glass"
Starter codePython
def normalize_plural(word):
# Your code here
pass5 test cases · run your code against them in the editor