Contar cuántas veces se repite cada palabra en un texto
# From this:
"I love Python because Python is easy"
# To this:
{
'python': 2,
'i': 1,
'love': 1,
'because': 1,
'is': 1,
'easy': 1
}
from collections import Counter
txt = "I love Python because Python is easy"
counts = Counter(txt.lower().split())
print(counts)