CHALLENGE : Finding the biggest word in a String !!!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 12

CHALLENGE : Finding the biggest word in a String !!!!

Write a program to input a sentence and print the biggest and the smallest word in the string . For example... Input : I love Coding Output : Smallest Word in The String: I Biggest Word in The String: Coding Any programming language you like... ! Good luck coders !!! :-)

3rd Dec 2017, 7:53 AM
Aaron Stone
Aaron Stone - avatar
13 Answers
3rd Dec 2017, 2:14 PM
Justine Ogaraku
Justine Ogaraku - avatar
4th Dec 2017, 12:35 AM
LukArToDo
LukArToDo - avatar
+ 10
https://code.sololearn.com/c4ZoO883ZEmh/?ref=app
4th Dec 2017, 2:16 AM
Käzî Mrîdùl Høssäîn
Käzî Mrîdùl Høssäîn - avatar
3rd Dec 2017, 8:06 AM
Shinjini Ghosh
+ 6
@Aaron.. Thank you! :)
3rd Dec 2017, 2:07 PM
Shinjini Ghosh
+ 5
@Shinjini.. great code !
3rd Dec 2017, 9:54 AM
Aaron Stone
Aaron Stone - avatar
+ 3
I probably could have fitted it in one line, but that would have made a mess and it wouldn't be the Pythonic way, so here is my two-liner: https://code.sololearn.com/cMc235zZi64u
3rd Dec 2017, 8:54 PM
Khashayar Farshchi
Khashayar Farshchi - avatar
5th Dec 2017, 5:17 AM
#RahulVerma
#RahulVerma - avatar
+ 2
phrase=input("write a phrase") x=phrase.split() max=0 min=0 for i in x: y=len(list(i)) if y>max: max=y long=i if min==0: min=y elif y<min: min=y short=i print("the longest word in your phrase is ",long) print("the shortest word in your phrase is ",short)
4th Dec 2017, 3:40 PM
pau lina
pau lina - avatar
4th Dec 2017, 7:44 PM
Deep Serket
Deep Serket - avatar
+ 1
https://code.sololearn.com/cois4kA80yNo/?ref=app This is my optimized solution in Java. It also says when two words along the phrase have the same size or if all the words inserted have the same size. I'm still working in some other cool features.
7th Dec 2017, 8:54 PM
Jonathan Álex
Jonathan Álex - avatar