0
Python
Hello, I would like to ask someone here a question because i got some homework from my IT teacher and i need to create a little programm where i write hi and hello and the 'user' that is writing something the smaller word has to come up and not the longer one. Does anybody have any idea with it?
5 Answers
+ 4
Dimitris Grigoriadis , please do not duplicate posts. This does not help getting more answers. Thanks!
+ 3
use the len function to know the length of a string .Then it's all about using if statement.
+ 2
Yes, but you could provide us with your attempt first. In addition you could use at the beginning the search function to find a few similar codes, projects, questions etc.
0
if I start the code like this :
txt = input()
word = txt.split()
l = len(word)
how you will complete it ?
0
Now that you've spilt your input....
have a look at the built-in "min" function, use key=len,.......but you need to also use list slicing.