Create an algorithm in Python that takes in a string and returns the number of words in the string.
"Hello world"
def word_count(s):
	words = s.split()
	return len(words)

s = "Hello world"

print(word_count(s)) # 2