Word count X86598


Statement
 

pdf   zip

html

Write an integer function word_count(s) that returns the number of words in string s. We assume all characters of s are letters and spaces. Warning: do not use the split string method.

Sample session
>>> word_count('Qui invenit amicum invenit thesaurum')
5
>>> word_count('alea iacta          est')
3
>>> word_count('KingKong')
1
Information
Author
ProAl
Language
English
Official solutions
Python
User solutions
Python