HomePagev2 Forums Python Discussions lists-practice-8 Reply To: lists-practice-8

  • Karri Bindu Madhavi

    Member
    February 9, 2021 at 1:27 pm

    thank you for your response sir,iam done with this code like this sir

    def word_counter(mystring):

    p = {}

    count = 0

    list_s = mystring.split()

    for word in list_s:

    if word in p:

    count = p[word]

    count +=1

    p.update({word: count})

    else:

    count=1

    p.update({word: count})

    return p