Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions count.py
Original file line number Diff line number Diff line change
@@ -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);