Computer Science, asked by mnhvcvbjkm, 8 months ago

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 Dhriti272
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 AmanSharma2511
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