0
import string
def main():
    print ("This program calculates the number of words in a sentence")
    sent = input("Enter a sentence: ")
    words = str.split(sent)
    print ("The total word count is:", len(words))
    print ("The total character count-withspace is:", len(sent))
    retry = input('''
Would you like to try again?''')
    if retry == ("Yes") or retry == ('yes') or retry == ('YES'):
        main()
main()

with this i get the word count and character count +1 after i hit enter, but what do i do so that the word count changes as i am typing, abit like the way it works on MS Word.

2
Contributors
3
Replies
6
Views
5 Years
Discussion Span
Last Post by pyTony
0

You do gui and put timer event to update word count.

cud you the code for that...i am new to python...just my second week in the language...and my thrid week in programming :D thanks

0

I give you chance to do something you don't know rather than do something I learned allready. If you get stuck I may help. You may also use callback on change of text widgets contents instead of polling the change by timer. read my signature for crash course on forum rules and do study the code snippet archive.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.