Python 3 – String min() Method

Python 3 – String min() Method

Description

min() method returns the smallest alphabetical character from the string str.

Syntax

Following is the syntax of the min() method −

min(str)

Parameters

str − This is the string from which the smallest alphabetical character is to be returned.

Return Value

This method returns the largest alphabetical character from the string str.

Example

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

#!/usr/bin/python3

str = "www.tutorialspoint.com"
print ("Minimum character: " + min(str))

str = "TUTORIALSPOINT"
print ("Minimum character: " + min(str))

Result

Running the above program will produce the following result: −

Minimum character: .
Minimum character: A

Leave a Reply

Your email address will not be published. Required fields are marked *