+ 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
MajesticPlatypus - avatar
3 Answers
+ 2
txt = input() print(max(txt.split(' '), key=len))
24th Nov 2021, 7:02 PM
Callie Schwieder
0
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
0
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
ChaoticDawg - avatar