text_plain_output_1.png image_output_1.png
def fibonacci(terms: int=1):
    out: list[int] = []
    for i in range(terms):
        if i == 0:
            out.append(0)
        elif i == 1:
            out.append(1)
        else:
            out.append(out[-2] + out[-1])
    return out

def countWords(string: str='', sep: str=', '):
    out: dict[str, int] = {}
    for t in string.split(sep):
        out[t] = string.count(t)
    return out
def frequentWord(wordCount: dict={}):
    out: tuple[str, int] = ('None', 0)
    for key, val in wordCount.items():
        if val > out[1]:
            out = (key, val)
    return out
Words = 'Perro, Gato, Conejo, Perro Lobo, Gato Leon, Gato Blanco'
WordsCount = countWords(Words)
print(WordsCount)
FrequentWord = frequentWord(WordsCount)
print(f'{FrequentWord[0]} se repite {FrequentWord[1]}', 'vez' if FrequentWord[1] == 1 else 'veces')