Finding the Shortest String Length

  • Share this:

Code introduction


This function accepts an arbitrary number of string arguments and returns the length of the shortest one among them.


Technology Stack : String handling

Code Type : String processing

Code Difficulty : Intermediate


                
                    
def get_min_length(*args):
    min_length = float('inf')
    for arg in args:
        if isinstance(arg, str) and len(arg) < min_length:
            min_length = len(arg)
    return min_length