py4e icon indicating copy to clipboard operation
py4e copied to clipboard

PY4E data structure EX:9.4

Open MennaAssal opened this issue 5 years ago • 1 comments

I tried a lot to do this exercise ,but I have errors. Could you please help me understand what is the problem?

name = input("Enter file:") if len(name) < 1 : name = "mbox-short.txt" handle = open(name) counts=dict() for line in handle: line = line.rstrip() if line == "" : continue words = line.split() for word in words: if words[1] != "From" : continue # if words == " ":continue counts[word]=counts.get(word,0)+1 bigcounts=None bigwords=None for word,count in counts.item(): if bigcounts is None or count>bigcounts: bigwords=word bigcounts=count print(bigwords,bigcounts)

`

MennaAssal avatar Aug 29 '19 21:08 MennaAssal

9.4 is an assignment so you can't get help here. Please use the discussions for the MOOC (Coursera, edX) that you are subscribed to.

srcatto avatar Dec 03 '19 16:12 srcatto