diff --git a/count.py b/count.py new file mode 100644 index 0000000..6935d53 --- /dev/null +++ b/count.py @@ -0,0 +1,9 @@ +# Python Program - Count Word in Sentence + +print("Enter 'x' for exit."); +string = input("Enter any string to count word: "); +if string == 'x': + exit(); +else: + word_length = len(string.split()); + print("\nNumber of words =",word_length); \ No newline at end of file