Join Regular Classroom : Visit ClassroomTech

Python String – max() function

It is an inbuilt function in python that returns the alphabetical character with the highest ascii value.

Syntax:

max(string)

Example 1:

s = “codewindow
x = max(s)
print(x)

Output:

w

Explanation:

Here the ascii value of “w” is the highest among all other characters. Thus it returned “w”.

Example 2:

s = “Code and hustle!
x = max(s)
print(x)

Output:

u

Explanation:

Here the ascii value of “u” is the highest among all other characters. Hence it returned “u”.

You Missed
Also Checkout