Project 62 in Python Core | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Project 62 in Python Core

Could someone walk me through how to solve questions like this? I don’t know where to start. All help is appreciated.

28th Sep 2021, 7:05 PM
MajesticPlatypus - avatar
3 Answers
+ 2
txt = input() print(max(txt.split(' '), key=len))
24th Nov 2021, 7:02 PM
Callie Schwieder
Hi! I think it would be more easy if you explaine the question here, and attach your code.
28th Sep 2021, 9:02 PM
Per Bratthammar
Per Bratthammar - avatar
Take the input 'txt' and split() it into a list of 'words'. Set the first word as the 'longest' word. Loop through the remaining 'words' list and check if the len() of the 'word' is greater than the len() of the 'longest'. If it is then set that 'word' as the new 'longest'. After the loop print() the 'longest' word.
28th Sep 2021, 9:56 PM
ChaoticDawg - avatar