Computer Science, asked by ramhari8075123, 4 months ago

25)Write a program to enter a string and
count number of words in the given string.
(3 marks) in python

Answers

Answered by vijayakumarchinthala
2

Answer:

a=input("Enter the string")

b=a.split()

print("number of words in given variable are",len(b))

Explanation:

1. a variable is stores the string data

2. split function splits all the words and stores individual words in a list

3. len returns the total number of elements in the list

Similar questions