1 Comment

Esta es mi solucion:

sentence = input("Enter a sentece: ")

words = sentence.split()

number_words = len(words)

longest_word = ''

longest_length = 0

for word in words:

if len(word) > longest_length:

longest_word = word

longest_length = len(word)

print(f'The number of words in sentence is: {number_words}')

print(f'The longes word is "{longest_word}", with {longest_length} characters')

Expand full comment