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.