def match_words(words):
    item = 0
    list = []

    for word in words:
        if len(word) > 1 and word[0] == word[-1]:
            item = item + 1
            mylist.append(word)
    print(mylist)
    return item


count = match_words(['abc', 'cfc','xyz', 'aba', '1221'])
print("number of words having first anf last characters same:",count)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: