I am trying to make a function that reads a document, and counts how many times a certain letter x appears in each row and inserts it into an array. After that, it will return whichever number appeared the most in the array. Here is what I have so far:
def LetterNumberCount(Letter):
document = open ('magazine.in', 'r')
letterOccurs = []
for (Number of Lines): #Here is my problem
line = document.readLine()
letterOccurs.extend(line.count(Letter))
return max(letterOccurs)
I need help finding the number of lines in the magazine. Is there a function to find the number of lines in something?