I need some help, PLEASE LOOK AT EDIT 2
This is code of huffman:
def printHuffTree(huffTree, prefix = ''):
if len(huffTree) == 2:
print huffTree[1], prefix
exampleData = [
(0.124167 , 'e')
]
if __name__ == '__main__':
huffTree = makeHuffTree(exampleData)
printHuffTree(huffTree)
output is:
e 00
t 01
a 10
i 11
I need some function or anything which can count this numbers; for example if
e 00
i need to count how many numbers is here: 2 (0 and 0)
so output that I need :
e 00 2
t 01 2
a 10 2
i 11 2
For edit 2:
Using your data in
exampleDataand ifcis the constant to multiply each by then:result = sum(c*i[0] for i in exampleData)I’m still not understanding the rest of your question.