In order to find the shortest word in a string e have to split the word and count the length of each word this can be achieved in the following two ways:
In primitive way we do the following type of coding:
def find_short(s):
minlen=len(s.split()[0])
length=0
for i in s.split():
length=len(i)
if(length<minlen):
minlen=length
return minlen
return=find_short('this is a hello world')
print(return)
#Now a days we do the same thing using :
def find_short(s):
return min(len(x) for x in s.split())