Python String max() Method Last Updated : 19 Nov, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report The string max() method returns the largest character in a string based on its Unicode value.Example: Python s = "hello" res = max(s) print(res) Outputo Explanation: In string "hello", the unicode values of the characters are compared and the character 'o' has the highest Unicode value.Syntax of string max() Methodmax(string)Parameter:string: A string for which we want to find the largest character. It cannot be empty.Return Type:Returns the largest character in the string based on Unicode. If the string is empty then it raises a ValueError.Note: ASCII is a subset of Unicode. Unicode has many more characters like non-English letters and emojis. For ASCII characters from 0 to 127 their values are the same in Unicode.Examples of string max() MethodMixed Case String Python s = "GeeksforGeeks" print(max(s)) Outputs Explanation: Here, max() function evaluates ASCII values for uppercase and lowercase letters separately. Since lowercase letters have higher ASCII values than uppercase case. So, 's' is largest character.String with Digits and Letters Python s = "abc123" print(max(s)) Outputc Explanation: The digits and letters are compared based on their ASCII values. Among the characters ('a', 'b', 'c', '1', '2', '3'), 'c' has the highest ASCII value.String with Special Characters Python s = "a!@#z" print(max(s)) Outputz Explanation: Special characters and alphabets are compared based on ASCII values. Here, 'z' has the highest ASCII value. Comment More infoAdvertise with us Next Article Python String max() Method S Striver Follow Improve Article Tags : Misc Python python-string Practice Tags : Miscpython Similar Reads Python List max() Method max() function in Python is a built-in function that finds and returns the largest element from the list. Let's understand it better with an example:Pythona = [2,3,6,1,8,4,9,0] print(max(a))Output9 Syntaxmax(listname)Parameter:listname : Name of list in which we have to find the maximum value.Return 4 min read Python | Decimal max() method Decimal#max() : max() is a Decimal class method which compares the two Decimal values and return the max of two. Syntax: Decimal.max() Parameter: Decimal values Return: the max of two. Code #1 : Example for max() method Python3 # Python Program explaining # max() method # loading decimal library fro 2 min read Python | Pandas Series.max() Pandas series is a One-dimensional ndarray with axis labels. The labels need not be unique but must be a hashable type. The object supports both integer- and label-based indexing and provides a host of methods for performing operations involving the index. Pandas Series.max() function return the max 3 min read Python | Decimal max_mag() method Decimal#max_mag() : max_mag() is a Decimal class method which compares the two Decimal values and return the max of two, with their sign ignored. Syntax: Decimal.max_mag() Parameter: Decimal values Return: the max_mag of two, with their sign ignored. Code #1 : Example for max_mag() method Python3 # 2 min read sys.maxint in Python In Python 2, sys.maxint refers to the maximum value an integer can hold on a given platform. This value is:2³¹ - 1 = 2147483647 on a 32-bit system2â¶Â³ - 1 = 9223372036854775807 on a 64-bit systemsys.maxint was typically used as a very large number in algorithms requiring an upper bound, like finding 3 min read Like