12.count words in a string

Write a program to count the number of individual words in a string.

def count_words(string):
    count = 0
    for word in string.split(' '):
        count += 1
    return count
count_words('Hello World')
2

For added complexity read these strings in from a text file and generate a summary.

def count_from_file(file_location):
    file = open(file_location, 'r')
    text = str(file.read())
    return count_words(text)
count_from_file("Info.txt")
14