Advertisements
Advertisements
प्रश्न
Write a program to input any string and find number of words in the string.
कोड लेखन
Advertisements
उत्तर
Use split() to divide the string into words and len() to count them.
s = input("Enter any string: ")
words = s.split()
print("Number of words =", len(words))
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
