Mar-17-2022, 11:07 AM
(This post was last modified: Mar-17-2022, 12:48 PM by Yoriz.
Edit Reason: Added code tags
)
Hello!
I have to create a function that takes as a parameter a list of strings. I need my function to return a number which is the position of the string with the shortest length.
I have succesfully created the function that finds the shortest string:
Note: I must not use for, while
I have to create a function that takes as a parameter a list of strings. I need my function to return a number which is the position of the string with the shortest length.
I have succesfully created the function that finds the shortest string:
def g(x): return min(x, key=len)But I can't figure a second function to return the position of this string.
Note: I must not use for, while