def add_mark_at ( string , index , mark ) : if index == - 1 : return string # Python can handle the case which index is out of range of given string return string [ : index ] + add_mark_char ( string [ index ] , mark ) + string [ index + 1 : ]
add marks to string in python
Add mark to the index - th character of the given string . Return the new string after applying change . Notice : index > 0
def add_mark_at(string, index, mark):
    """
    Add mark to the index-th character of the given string. Return the new string after applying change.
    Notice: index > 0
    """
    if index == -1:
        return string
    # Python can handle the case which index is out of range of given string
    return string[:index] + add_mark_char(string[index], mark) + string[index+1:]