Mutations

  • + 0 comments

    def mutate_string(string, position, character):

    q = list(string)
    q[position] = f'{character}'
    length = len(q)
    ss = ""
    x=0
    def concatinate():
        nonlocal q
        nonlocal x
        nonlocal ss 
        if x < length :
            ss+= str(q[x]) 
            x+=1 
            return concatinate()
    concatinate()    
    print(ss)
    

    mutate_string("eerwewewe232xz",8,"%@#!")