V
vertigo
Hello
I receive such error:
File "p4.py", line 24, in PrintWordCountFloat
print "%s %f" % (word,words[word])
TypeError: list indices must be integers
i call PrintWordCountFloat with hash table, keys are words(string) and
values float.
This part of the code:
def PrintWordCountFloat(words):
number = 0
for word in words:
print "%s %f" % (word,words[word]) #line 24
number = number + 1
print "Total words: %d" %(number)
My function displays whole table correctly, and after that i receive
mentioned error.
Why ? Where is the problem ?
Thanx
I receive such error:
File "p4.py", line 24, in PrintWordCountFloat
print "%s %f" % (word,words[word])
TypeError: list indices must be integers
i call PrintWordCountFloat with hash table, keys are words(string) and
values float.
This part of the code:
def PrintWordCountFloat(words):
number = 0
for word in words:
print "%s %f" % (word,words[word]) #line 24
number = number + 1
print "Total words: %d" %(number)
My function displays whole table correctly, and after that i receive
mentioned error.
Why ? Where is the problem ?
Thanx