Did you check my code which did the job? http://www.daniweb.com/forums/post1270109.html#post1270109
Could you express in words or flow chart the logic of program and find anything missing.
HINT: How are you counting the number of different values and sum of the values for every key separately from each other?
pyTony
pyMod
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
The following part of your code doesn't make sense. You should go back to where ever the code came from and double check that it was copied correctly, and that you copied all of the code supplied. Also, print the dictionary to see what it contains.
clist= {}
for word in wordsdict:
if word in times:
average = wordsdict[word] / times[word]
clist = {word:average} [
Edit: This probably doesn't do what you think either. Start by breaking it down into simple steps and then code each step.
if word not in wordsdict:
wordsdict[word] = cvalue
times[word] = 1
else:
times[word] = 1
wordsdict[word] = sum([cvalue,wordsdict[word]])
times[word] = times[word] + 1
woooee
Nearly a Posting Maven
2,454 posts since Dec 2006
Reputation Points: 777
Solved Threads: 714