how to count the words, add total words, calculate the total and avg word length in python : > Blockquote
# I need help to add the totals of all words, word lengths and calculate average word length
> Blockquote

    file=open(r"sheSaid.txt","r+")

        from collections import Counter
        wordcount = Counter(file.read().split())
        for word in file.read().split(' '):
        word = word.rstrip(".""',?!")
        if word not in wordcount:
            wordcount[word] = 1
        else:
     wordcount[word] += 1

    #print (word.rstrip(".""..',?!"),wordcount)
    for item in wordcount.items(): print("{}\t{}".format(*item))
    wordCount = len(wordcount)

    print ("The total word count is:", word, wordCount)
    print ("The total length of all words are:", word, wordCount/5)
    print ("The total word length is:", total)
    file.close();