0% found this document useful (0 votes)
33 views1 page

Counting Number of Words

This Python code takes a string as input from the user, splits it into a list of words using the split() method, and prints the length of the resulting list to count and display the number of words in the original string.

Uploaded by

Chirag Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views1 page

Counting Number of Words

This Python code takes a string as input from the user, splits it into a list of words using the split() method, and prints the length of the resulting list to count and display the number of words in the original string.

Uploaded by

Chirag Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#Using Python

#Counting the number of words in a String

string=input("Enter a string:")
words=string.split()
print("Number of words in the String are:",len(words))

You might also like