Python String min() Method


Contents

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 Python programming language which 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 following result:

Min character: !
Min character: !

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



Navigation
Tutorial
Tutorial
Tutorial