How can i find the longest word in text which is given? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i find the longest word in text which is given?

txt = input() print(max(txt.split(", "))) Where is my mistake ? What should i change ?

4th Dec 2020, 11:20 AM
Qudrat Iskandarov
Qudrat Iskandarov - avatar
2 Answers
+ 3
you got split right! (if the comma is really needed)you may want to look into the len() function and compare to max()
4th Dec 2020, 11:27 AM
Slick
Slick - avatar
+ 1
I got u thanks bro
4th Dec 2020, 11:28 AM
Qudrat Iskandarov
Qudrat Iskandarov - avatar