0

I need help to complete a test

Good morning community, I need your help to be able to solve a Python test. They ask me to extract the longest word from a text with the "split()" method, I use it with the "max()" method but from all the text I only get two letters. I don't know how to fix it anymore.

15th Jul 2022, 2:55 PM
Jhozmer A. Ramírez P.
Jhozmer A. Ramírez P. - avatar
3 Antworten
+ 4
Please show your code. Hint: max() has a key parameter.
15th Jul 2022, 2:57 PM
Lisa
Lisa - avatar
+ 2
Check the split-function: You split at double white spaces, not on single white spaces. Either loop through the list to find the longest word or use the key parameter of max() https://www.geeksforgeeks.org/JUMP_LINK__&&__python__&&__JUMP_LINK-longest-string-in-list/
15th Jul 2022, 3:48 PM
Lisa
Lisa - avatar
0
txt = input() #tu código va aquí: text = txt.split(' ') text1 = max(text) print(text1)
15th Jul 2022, 3:36 PM
Jhozmer A. Ramírez P.
Jhozmer A. Ramírez P. - avatar