We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
defmutate_string(string:str,position:int,character:str)->str:"""Replace the character at the given position with a new one."""ifnot(0<position<=len(string)):raiseValueError("Position out of range")returnstring[:position]+character+string[position+1:]if__name__=='__main__':s=input()i,c=input().split()s_new=mutate_string(s,int(i),c)print(s_new)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Mutations
You are viewing a single comment's thread. Return to all comments →