+ 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.
3 Answers
+ 2
txt = input()
print(max(txt.split(' '), key=len))
0
Hi! I think it would be more easy if you explaine the question here, and attach your code.
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.