logo

Python String Min() Method


Show

Description

The min() method in Python String returns the min alphabetical character present in the string str. The min()method is again an inbuilt function in the Python programming language that returns the minimum alphabetical character present within a string. The Return value in this case is a character that is alphabetically the lowest character present in the string.

Syntax

Here is the syntax for min() method:

min(str)

Parameters

  • str - This is the string where min alphabetical character shall be returned.

Return Value

This method is responsible for returning the min alphabetical character from within the string str.

Example

The example below shows the usage of min() method.

#!/usr/bin/python

str = "this-is-real-string-example....wow!!!";
print "Min character: " + min(str)

str = "this-is-a-string-example....wow!!!";
print "Min character: " + min(str)

When the above program is made to run, it produces the following result:

Min character: !
Min character: !

Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.