write the code in python to accept string and print total number of words and character
Answers
Answered by
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