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 :-

  1. x=input("enter your meassage here") 
  2. print(len(x.split()) 

Comments

Popular posts from this blog

Proassignmenthelp index 27

Proassignmenthelp index 28

Programmingshark index 19