In any case, I do not think I'll be posting my standard homework pieces from this semester. I will, however, provide some Python programming:
#---------------------------------------------------------------------------------
#5.6: Write a program that reads in a file and then prints out the number of lines, words, and characters in a file.
#---------------------------------------------------------------------------------
def fileCounts(fileName):#5.6: Write a program that reads in a file and then prints out the number of lines, words, and characters in a file.
#---------------------------------------------------------------------------------
fileObj = open(fileName)
#makes a list of all of the lines in a file
lineList = fileObj.readlines()
#gets amount of items in lineList
lineCount = len(lineList)
#setting counters
wordCount = 0
charCount = 0
for theLine in lineList:
#increase wordCount by the result of len(theline.split())
wordCount = wordCount + len(theLine.split())
#increase charCount by the result of len(theLine)
charCount = charCount + len(theLine)
print ("There are", lineCount, "lines", wordCount, "words and", charCount, "characters in this document")
Who would have known that I would get into Python programming? This is one of my later homework assignments- the first few chapters were hard, but only for me. The rest of the Python programming world would laugh at the hours I spent staring at my computer screen, not knowing what to do. At least I know that I am learning something.