Hi..me again. I am trying to incorporate this function which counts the periods into the code..however, I can not get the code to output both the line count, blank line count, and period count at the same time. This is my 3rd or 4th try at adding this into the code in different positions. What happens right now is a valueerror, in previous spots lines were returning 0 or periods was returning 0.
def percount(myFile): periods = 0 for char in myFile.read(): if char == '.': periods +=1 return periods lines = 0 blanklines = 0 myFile = open("inn.txt", "r") for line in myFile: lines +=1 if line == ('\n'): blanklines +=1 for char in line: p = percount(myFile) print "The total number of lines in the file is",lines print "The total number blank lines in the file is", blanklines print "The total number of periods in the file is", p