Please Login in order to post a comment
def mutate_string(string, position, character): string = string[:int(position)] + str(character) + string[int(position)+1:] return string
li = list(string) li[position] = character return "".join(li)
I think this code work perfectly
def mutate_string(string, position, character): lst = list(string) lst[position] = character string1 = ' '.join(lst) return string1
if name == 'main': s = input() i, c = input().split() s_new = mutate_string(s, int(i), c) print(s_new)
def mutate_string(string, position, character): C=list(s) C[position] = character
return ''.join(C)
Another Solution
def mutate_string(s, i, c): s_list = list(s) s_list[i] = c return "".join(s_list)
Seems like cookies are disabled on this browser, please enable them to open this website
def mutate_string(string, position, character): string = string[:int(position)] + str(character) + string[int(position)+1:] return string
I think this code work perfectly
def mutate_string(string, position, character): lst = list(string) lst[position] = character string1 = ' '.join(lst) return string1
if name == 'main': s = input() i, c = input().split() s_new = mutate_string(s, int(i), c) print(s_new)
def mutate_string(string, position, character): C=list(s) C[position] = character
Another Solution