Question: PYTHON CMSC 206 Why THIS CODE DOES NOT WORK???? CAN YOU FIX IT AS SOON AS PLEASE!!!!??? word_count = {} with open(abc.txt, r) as file:
PYTHON CMSC 206
Why THIS CODE DOES NOT WORK????
CAN YOU FIX IT AS SOON AS PLEASE!!!!???
word_count = {}
with open("abc.txt", "r") as file:
text = file.read()
words = text.split()
for word in words:
if word in word_count:
word_count [word] += 1
else:
word_count[word] = 1
print(word_count)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
