# word_counter.py
# This program counts the number of words in a sentence entered
# by the user.
# by: Scott Gordon
def main():
# Print greeting message
print("***** Welcome to Word Counter *****")
# Input users sentence and assign it to a variable.
text = input("Enter your sentence here: ")
# Split the sentence and save it to a list.
split_text = text.split()
# Count the number of words in the list.
word_count = 0
for word in split_text:
word_count += 1
# Print word count to the screen.
print(f"The word count for your sentence is: {word_count}")
main()
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)