I am trying to find the third person singular form of a verb passed to my function. So far I have this:
suffixes = ['o', 'ch', 's', 'sh', 'x', 'z']
def third_person(s):
r = ''
if s.endswith('y'):
r = s[:-1]
r += 'ies'
else:
r += s + 's'
return r
Which works, but for the case that the verb ends with any of the suffixes in suffixes list, I want to add 'es' to the verb. I have tried this:
if s.endswith(c for c in suffixes):
s += 'es'
But python says that I can't pass a generator to a function. I could move the if block inside a for loop but then I would have to change other checks as well. How do I do this without wrapping the if block with a for loop?