count words from input string in Python
count words from input string in Python
first of all we have to take input from user and after that we have to split it and with the help of len () we can count it. split() function simply distribute your sentence into words group and after that it will be very simple.
Let’s see an Example of it.
Example :-
- x=input("enter your meassage here")
- print(len(x.split())
Comments
Post a Comment