This is what I have done when there is no HTML codes
from collections import defaultdict
hello = ["hello","hi","hello","hello"]
def test(string):
    bye = defaultdict(int)
    for i in hello:
        bye[i]+=1
    return bye
And i want to change this to html table and This is what I have try so far, but it still doesn't work
 def test2(string):
    bye= defaultdict(int)
    print"<table>"
    for i in hello:
        print "<tr>"
        print "<td>"+bye[i]= bye[i] +1+"</td>"
        print "</tr>"
    print"</table>"
    return bye