Answer:
#HERE IS CODE IN PYTHON
#function to find length of shortest and longest string in the array
def fun(list2):
#find length of shortest string
mn=len(min(list2))
#find length of longest string
mx=len(max(list2))
#return both the value
return mn,mx
#array of strings
list2 = ['Ford', 'Volvo', 'BMW', 'MARUTI','TATA']
# call the function
mn,mx=fun(list2)
#print the result
print("shortest length is:",mn)
print("longest length is:",mx)
Explanation:
Create an array of strings.Call the function fun() with array as parameter. Here min() function will find the minimum string among all the strings of array and then len() function will find its length and assign to "mn". Similarly max() will find the largest string and then len() will find its length and assign to "mx". Function fun() will return "mn" & "mx".Then print the length of shortest and longest string.
Output:
shortest length is: 3
longest length is: 5