Computer Science, asked by alkavicky2, 4 months ago

write the code in python to accept string and print total number of words and character​

Answers

Answered by 2008shrishti
6

Answer:

string=raw_input("Enter string:")

char=0

word=1

for i in string:

char=char+1

if(i==' '):

word=word+1

print("Number of words in the string:")

print(word)

print("Number of characters in the string:")

print(char)

Explanation:

Hope this answer will help you

Similar questions