Finding the shortest string in a string of words in python
I want to write a function that would return the length of the shortest string in a string of words. Sample: "I eat apples" would return 1 since "I" is the shorted string. This is what I did but mincount does neither increment nor set up to 0 at the end of each string. What is wrong with it? def find_short(s): min=99 for i in s: mincount = 0 for j in i: print(j) mincount += 1 print(mincount) if (mincount < min): min = mincount return min line = "I eat apples" mins = min(len(word) for word in line.split()) print(mins) line.split() will split line into list of words and then just finding the