Get Smallest of Strings Lexicographically

To find the smallest of given List of strings lexicographically in Python, call min() builtin function and pass the strings as arguments or the list of strings as argument to this function.

min() function returns the string that occurs first when the given strings are sorted lexicographically in ascending order.


In the following program, we shall take a list of string and find the lexicographically smallest string in the list using min() function.

myList = ['mango', 'apple', 'orange']
result = min(myList)
print(f'Minimum of given list is {result}.')
Try Online


Minimum of given list is apple.


In this Python Tutorial, we have learnt how to find the smallest string of given list lexicographically, with the help of min() function.