Solution 1

def find_max_char(a_string):
    max_found = ''
    for char in a_string:
        if char > max_found:
            max_found = char
    return max_found

Fix the Max Character

The function provided is broken. Your job is to figure out what's going on and fix it.

Use the tests to guide you.

Test Cases

test find max character - Run Test

def test_find_max_character():
    assert find_max_char('arjbo') == 'r'

    assert find_max_char('ABCDEFGH') == 'H'

    assert find_max_char('HGFEDCBA') == 'H'

    assert find_max_char('a') == 'a'
def find_max_char(a_string): # THIS IS BROKEN # YOUR JOB IS TO FIX IT # You can change this function as much as you want max_found = None for char in a_string: if char > max_found: max_found = char return max_found