I wanna make word count and list how many times word counted. But
f = open("Les.Miserable.txt", 'r')
words = f.read().split()
words.sort()
wordCount = ()
for i in range(len(words)):
words[i] = words[i].replace(".", ""), (",", ""), ("/", ""), ("?", ""), ("!", "")
words[i] = words[i].upper()
if words[i] not in wordCount:
wordCount[words[i]] = 1
else:
wordCount[words[i]] += 1
i can see error message 'tuple' object has no attribute 'upper' in
words[i] = words[i].upper()
here
and also error message 'tuple' object does not support item assignment in
wordCountint[words[i]] = 1
Please let me know know what is the problem
wordCounta tuple not a list?wordsnotwords[i]