python program doesn’t work

The str.find finds the index of the item. You need to use str.count.

def ex4(str4):

    someLetter = str4[ :1]
    return str4.count(someLetter)

print ex4("mldtmgm")

Leave a Comment