Write a program in python to input a string and count the words in it.
input a string and count the words in it.
Answers
Answered by
3
Answer:The program takes a string and calculates the number of words and characters present in the string.
Take a string from the user and store it in a variable.
Initialize the character count variable to 0 and the word count variable to 1.
Answered by
1
Answer:
var a, len, c=0;
a=input("Enter a string") ;
len=a.length();
for(var i=0;i<l;i++)
{
c=c+1;
}
print(c);
This program format works in java please change it in python code, i haven't learned python but new basics so I sent try this its logic is 100% correct
Similar questions
English,
4 months ago
Social Sciences,
4 months ago
India Languages,
4 months ago
Science,
8 months ago
English,
1 year ago
Science,
1 year ago