def countPrefix(words, prefix):
    return len([1 for w in words if w.startswith(prefix)])

words = ['rato', 'roeu', 'rolha', 'rainha', 'rei', 'russia']
pref = ['ro', 'ra', 'r']

result = [countPrefix(words, p) for p in pref] 

print result