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
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
