Nauč se Python > Kurzy > Beginners course PyLadies > Strings > Strings

Strings – Řešení [4]

def change(string, position, character):
    """This function inserts the given character into the given position.

    Returns a new string which has the given character in the given
    position. The rest is the same as the original string.
    """

    return string[:position] + character + string[position + 1:]

Toto je stránka lekce z kurzu, který probíhá nebo proběhl naživo s instruktorem.