text: Program to find the largest and smallest ASCII valued characters in a string | Function that return the largest alphabet ; Initializing max alphabet to 'a ; Find largest alphabet ; Returning largest element ; Function that return the smallest alphabet ; Initializing smallest alphabet to 'z ; Find smallest alphabet ; Returning smallest alphabet ; Driver code ; Character array ; Calculating size of the string ; Calling functions and print returned value
code: def largest_alphabet ( a , n ) : NEW_LINE ' NEW_LINE INDENT max = ' A ' NEW_LINE for i in range ( n ) : NEW_LINE INDENT if ( a [ i ] > max ) : NEW_LINE INDENT max = a [ i ] NEW_LINE DEDENT DEDENT return max NEW_LINE DEDENT def smallest_alphabet ( a , n ) : NEW_LINE ' NEW_LINE INDENT min = ' z ' ; NEW_LINE for i in range ( n - 1 ) : NEW_LINE INDENT if ( a [ i ] < min ) : NEW_LINE INDENT min = a [ i ] NEW_LINE DEDENT DEDENT return min NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT a = " GeEksforGeeks " NEW_LINE size = len ( a ) NEW_LINE print ( " Largest ▁ and ▁ smallest ▁ alphabet ▁ is ▁ : ▁ " , end = " " ) NEW_LINE print ( largest_alphabet ( a , size ) , end = " ▁ and ▁ " ) NEW_LINE print ( smallest_alphabet ( a , size ) ) NEW_LINE DEDENT ' NEW_LINE