I'm attempting to make a function that counts the number of sentences in a textfile. In this case, a sentence refers to any string ending with either a '.', '?', or a '!'.

I'm new to Python and I'm having trouble figuring out how to do this. I keep getting the error 'UnboundLocalError: local variable 'numberofSentences' referenced before assignment.' Any help would be appreciated!

```
def countSentences(filename):
    endofSentence =['.', '!', '?']
    for sentence in filename:
        for fullStops in endofSentence:
            if numberofSentences.find(fullStops) == true:
                numberofSentences = numberofSentences+1
    return numberofSentences
print(countSentences('paragraph.txt'))

```