Hi Need a simple Python program to accept a list of 3 items. word_list = ['apple', 'berry', 'melon'] Using a function to convert singular to plural. If item ends with 'y', should replace that with 'ies'. Thanks so much
Just make it so that it appends "s" unless the word ends with "y" or some other exception:
def plural(word):
wordlist = []
for char in word:
wordlist.append(char)
if word[len(word)-1] == "y":
wordlist[len(word)-1] = "ies"
else:
wordlist.append("s")
word = ""
for i in wordlist:
word+=i
return word
print(plural("STRING"))